On Wed, 18 Apr 2001, James Howe wrote:

> I'm using the <bean:write> tag to add parameters to a dynamically generated 
> URL used by some javascript on my JSP page.  The problem with <bean:write> 
> is that it doesn't URL encode the result.  In general, this is probably a 
> good thing.  However, there are times when it would be nice to have the 
> value encoded.  Would it be possible to add an additional optional tag to 
> WriteTag which would indicate whether the result was to be URLEncoded?  The 
> default would be false which would not require any changes in current 
> code.  Also, if there is an alternative way to get this functionality, 
> please let me know.  Unfortunately I can't use the "link" tag in this 
> circumstance.
> 
> Basically I have a line in my file which looks like this:
> 
> <input type="button" ... onClick="self.location="foo.do?key='<bean:write 
> ...>'">
> 
> In other words, I'm building up the parameters to the location URL based on 
> property values in a particular bean.
> 
> Thanks.
> 
> 

Just to avoid confusion, are you talking about calling
response.encodeURL() to make sure that the session id is included for
clients that do not use cookies?  If so, doing it only on the value of the
"key" parameter (as shown in your example above) would not be sufficient
even if it was supported -- you can only call encodeURL() with the
*entire* URL you want to have encoded.

However, that doesn't mean an encode="true" option might not be
useful.  It would go along with the filter attribute (to filter out
characters sensitive in HTML) that defaults to "true".

Craig


Reply via email to