struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dennis Muhlestein <den...@zserve.com>
Subject Re: html:rewrite possible bug
Date Mon, 05 May 2003 20:47:18 GMT
  >Encoding the ampersand is the way it's supposed to work.
 >
  >
 >David

The rewrite tag specifies in the documentation that it is supposed to 
output the parameters the same way the link tag does.  The output is not 
the same though.

Note that the values of the parameters do NOT contain an ampersand.
The values for PARAM1 and PARAM2 are 1 and 2 respectively.

The expected output is PARAM1=1&PARAM2=2

When you encode the ampersand ie: PARAM1=1&amp;PARAM2=2
The decoded params and values are
PARAM1=1
amp;PARAM2=2

This is not the same output as the link tag.  The link tag gives the 
expected output and only encodes the parameter values.

Remember, this only occurs when using the name attribute with the 
rewrite tag.

Please advise

-Dennis

Dennis Muhlestein wrote:
> We use the rewrite tag occasionally within some javascript.  We have
> never used it with more than one parameter until today.
> 
> Today when trying though, the outputted html is incorrect.
> 
> Snippet:
> <<<<<<<<<<<
> <%      java.util.Hashtable parms = new java.util.Hashtable();
>         parms.put ( "PARAM1", "1" );
>         parms.put ( "PARAM2", "2" );
>         pageContext.setAttribute( "parms", parms ); %>
>     <!--
>     function MsgWindow()
>     {
>             newWindow = open("<html:rewrite href="/SomeLink"
> name="parms" />", .......
> 
>>>>>>>>>>>>>
> 
> The expcted Output is /SomeLink?PARAM1=1&PARAM2=2
> 
> Instead, we get /SomeLink?PARAM1=1&amp;PARAM2=2
> (NOTE THE &amp;)
> 
> Our workaround for right now is to use a small jsp code snippet to write 
>  our own parameter string, then pass that string to the href parameter 
> of the rewrite tag.
> 
> Is this a known issue?  Something is double encoding the parameter 
> string.  Should I file a bug on this?  It seems like a small issue to 
> fix before 1.1.
> 
> html:rewrite & sslext:rewrite are affected the same way.
> 
> Neither html:link or sslext:link show this behavior. (Docs say they
> should behave the same minus the "<a href..." part)
> 
> We are using 1.1rc1 but also tried this with the nightly build: 20030501
> 
> 
> TIA
> -Dennis
> 
> 
> 


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


Mime
View raw message