struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: & characters are encoded as &amp; in OGNL parameters
Date Tue, 29 May 2007 19:35:23 GMT
Sami Dalouche wrote:
> Hi,
> 
>>> Is it possible to disable this behaviour somehow ?
>> Depends how you're using the URL. Are you sure you even *want* to 
>> disable the behaviour? Encoding ampersands is generally the right thing 
>> to do.
> 
> Well, yeah, I do want to disable it.
> Basically, I need to generate the fully qualified (hostname, port,
> context, action) URL of the current page (with different parameters), so
> that I can encode it (using URLEncoder), append it to
> http://maps.google.com/q={myUrl}
> 
> The problem is that URLEncoder WILL encoder & correctly, so I don't want
> struts to process it before I do.
> 
> So, is it possible to disable this &amp; encoding ?

Hmm, well, you haven't described how you're using the url produced with 
the s:url tag other than 'reusing the url #id in some OGNL parameter'; 
that's a bit vague. Assuming you're using OGNL to pass the URL value to 
a method you've written, you can pre/post process the value any way you 
want.

The s:url tag has an 'encode' attribute to control whether the URL 
should be encoded [1], which is true by default. Perhaps all you need is 
to set that appropriately.

L.

[1] http://struts.apache.org/2.x/docs/url.html


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


Mime
View raw message