tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Taylor" <>
Subject RE: Mixing JSTL with scriptlet and problematic evaluation order
Date Tue, 14 Dec 2004 12:11:27 GMT
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="">
  <c:param name="sortId" value="${sortId}"/>
  <c:param name="title" value="${titleText}"/>

onclick="'${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.


-----Original Message-----
From: Rahul P Akolkar [] 
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="${sortId}&...&title=${titleText}&..."/>

onclick="'${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="'<c:out
> value="${sortId}"/>&......&title=' + '<%= URLEncoder.encode("<c:out

> value='${titleText}'/>", "UTF-8") %>', 'Foobar'....

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message