You are right. In my JSP for newUrl in my example, I was using <s:property
value="#parameters.backLink"/> and that was escaping th '&' once again I
think. Now, I changed that to <s:property value="#parameters.backLink"
escape="false"/> and that works. Thanks!
- SN
Laurie Harper wrote:
>
> Srinivas.N. wrote:
>> When I pass URLs as parameters, is there a way to not html escape the '&'
>> characters?
>>
>> Example: Lets say I have a JSP where I want to pass a URL as a param
>> within
>> another URL. Example:
>>
>> Some JSP
>> ---------
>>
>> <!-- Get the current URL -->
>> <s:url id="currentUrl" includeParams="get"/>
>>
>> <!-- Construct a new url passing the current URL as the backLink" -->
>> <s:url id="newUrl" action="newAction">
>> <s:param name="backLink" value="%{currentUrl}"/>
>> </s:url>
>>
>> Lets say current URL is something like http://mydomain/action1?p1=1&p2=2
>>
>> The problem is that when newUrl is constructed, struts2 is escaping the
>> '&'
>> character in the URL. So, the backLink says p1=1 & amp ;p2=2 instead of
>> p1=1&p2=2 (note: i put the spaces between & amp and ; just for clarity
>> here
>> so that this editor doesnt convert it to a '&') . This is preventing the
>> parameter p2 from being parsed correctly when that URL is requested.
>>
>> Is there an escape property on s:url like the one on <s:property> ? Any
>> workarounds?
>
> Not really; the behaviour you're seeing is correct. You absolutely want
> that escaping to happen, otherwise newUrl would be an invalid/malformed
> URL. The backLink parameter should be un-escaped again by the time you
> retrieve its value, so the problem you're having probably lies elsewhere.
>
> L.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/-S2--Not-escaping-%27-%27-when-passing-urls-as-http-params-tp15419699p15421391.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]