tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <ogjunk-tag...@yahoo.com>
Subject RE: Mixing JSTL with scriptlet and problematic evaluation order
Date Tue, 14 Dec 2004 20:19:36 GMT
Rahul & Christian,

Thank you very much - I completely missed the c:url option for this. 
This works for me.

Otis

--- Christian Taylor <christian.taylor@acadiau.ca> wrote:

> Or use <c:param> tags so you don't end up with a messy string that
> you have to insert ? And & into yourself:
> 
> <c:url var="encodedUrl" value="Blah.do">
>   <c:param name="sortId" value="${sortId}"/>
>   <c:param name="title" value="${titleText}"/>
>   ...
> </c:url>
> 
> onclick="javascript:window.open('${encodedUrl}', ...)"
> 
> <c:url> will take care of properly adding the <c:param> tags to the
> URL as query parameters, as well as adding the session ID if
> necessary.
> 
>  -Christian
> 
> -----Original Message-----
> From: Rahul P Akolkar [mailto:akolkar@us.ibm.com] 
> Sent: Monday, December 13, 2004 8:15 PM
> To: Tag Libraries Users List
> Subject: Re: Mixing JSTL with scriptlet and problematic evaluation
> order
> 
> 
> <c:url var="encodedUrl"
> value="Blah.do?sortId=${sortId}&...&title=${titleText}&..."/>
> 
> onclick="javascript:window.open('${encodedUrl}', ...)"
> 
> 
> 
> > Because I couldn't find a nice JSTL solution, I tried it with a 
> > mixture of JSTL and the scriptlet:
> > 
> > ...&title=' + '<%= URLEncoder.encode("<c:out
> value='${titleText}'/>",
> > "UTF-8") %>'
> >
> > Guess what this results in?
> > Well, the scriptlet part must be getting interpreted first, so the 
> > URLEncoder.encode gets that "<c:out value..." string literal as
> input, 
> > instead of getting the output of c:out.  So that doesn't work
> either.
> > 
> > Here is a bit more of the JavaScript call in question:
> > 
> > onclick="javascript:window.open('Blah.do?sortId=<c:out
> > value="${sortId}"/>&......&title=' + '<%= URLEncoder.encode("<c:out
> 
> > value='${titleText}'/>", "UTF-8") %>', 'Foobar'....
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: taglibs-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message