struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Wilkinson" <>
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

        // Perform URL rewriting to include our session ID (if any)
        if (pageContext.getSession() != null) {
            HttpServletResponse response = (HttpServletResponse)
            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.


David Wilkinson

-----Original Message-----
From: David Graham [] 
Sent: 18 June 2003 14:37
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.


>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
>upon looking at the code I have noticed that the class
>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
>                                     url =
>                                                             forward,
>                                                             href,
>                                                             page,
>                                                             null,
>                                                             params,
>                                                             anchor,
>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
>it is so important to do this then why was the same code not included
>the LinkTag which is still passing the redirect parameter as false.
>David Wilkinson

Help STOP SPAM with the new MSN 8 and get 2 months FREE*

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message