struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Wilkinson" <d...@iquo.co.uk>
Subject RE: Problem with the html:rewrite tag
Date Wed, 18 Jun 2003 15:02:04 GMT
Ok I under stand the need to not encode the & when using the
<html:rewrite> in javascript as iam using the tag in javascript myself.

But looking into what is happening in the code still does not make sense
to me, why is the redirect parameter being used for this encoding.
According to the following code taken from the computeURL method in
RequestUtils


        // Perform URL rewriting to include our session ID (if any)
        if (pageContext.getSession() != null) {
            HttpServletResponse response = (HttpServletResponse)
pageContext.getResponse();
            if (redirect) {
                return (response.encodeRedirectURL(url.toString()));
            } else {
                return (response.encodeURL(url.toString()));
            }
        } else {
             return (url.toString());
         }

the only time the url string will be encoded is if there is an active
session object and if there is then the url will be encoded regardless
just using different methods to do so. Which to me says there is an
error with the logic of using the redirect flag.

Regards

David Wilkinson


-----Original Message-----
From: David Graham [mailto:dgraham1980@hotmail.com] 
Sent: 18 June 2003 14:37
To: struts-dev@jakarta.apache.org
Subject: Re: Problem with the html:rewrite tag

The ampersand is only encoded in xhtml mode because people wanted to use

<html:rewrite> in javascript which breaks with encoded ampersands.

David

>Hi
>
>Since getting hold of struts 1.1 RC2 I have been getting a problem with
>the rewrite tag generating a url with the context root in twice.
>I have seen that this error has been raised as an error under
>
>http://issues.apache.org/bugzilla/show_bug.cgi?id=20835
>
>upon looking at the code I have noticed that the class RewriteTag.java
>has been changed between RC1 and RC2 to in clued the following
>
>             // Note that we're encoding the & character to &amp; in
>XHTML mode only,
>             // otherwise the & is written as is to work in
javascripts.
>                                     url =
>
RequestUtils.computeURL(
>
pageContext,
>                                                             forward,
>                                                             href,
>                                                             page,
>                                                             null,
>                                                             params,
>                                                             anchor,
>
>!this.isXhtml());
>
>My question is why is the isXhtml() value being passed as the redirect
>parameter to computeURL, as this does not make sense, what has
>redirecting the URL got to do with the encoding any & characters. And
if
>it is so important to do this then why was the same code not included
in
>the LinkTag which is still passing the redirect parameter as false.
>
>Regards
>
>David Wilkinson
>

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail


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





---------------------------------------------------------------------
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