Re: [Fwd: Support for &amp; as a parameter separator in <c:url>]

Rashmi Rubdi <[email protected]>
Newsgroups gmane.comp.jakarta.taglibs.user
Message-ID <[email protected]>
There is a way to get the escaped ampersand with

c:url and c:out when you set the escapeXml attribute
of c:out to true, it converts the & to &amp;

You will have to "View Source" in your browser to see
the &amp; 

      <c:url var="someURL"
value="http://www.somesite.com/index.jsp" >
          <c:param name="item" value="123" / >
          <c:param name="isbn" value="55555" / >
      < / c:url>

      <c:out value="${someURL}" escapeXml="true" / >

Hope this helps.
-Rashmi

--- Mikolaj Rydzewski <[email protected]> wrote:

> Hi,
> 
> Current version of JSTL's standard.jar does not use
> &amp; as a parameter 
> separator in generated URLs (the c:url and c:param
> tags). There are more 
> and more XHTML enabled sites and such behavior makes
> generated pages not 
> valid XML (more information at 
>
http://www.htmlhelp.com/tools/validator/problems.html#amp).
> 
> The patch is very simple, one has to change 
> ParamSupport.aggregateParams() method in 
> org.apache.taglibs.standard.tag.common.core package
> to add &amp; instead 
> of just &.
> 
> Are there any plans to add this funcionality to
> future releases?
> 
> Regards
> 
> -- 
> Mikolaj Rydzewski <[email protected]>
> 
> > --- ParamSupport.java-orig	2006-09-25
> 12:26:10.000000000 +0200
> +++ ParamSupport.java	2006-09-25 12:27:04.000000000
> +0200
> @@ -157,7 +157,7 @@
>  	    for (int i = 0; i < names.size(); i++) {
>  		newParams.append(names.get(i) + "=" +
> values.get(i));
>  		if (i < (names.size() - 1))
> -		    newParams.append("&");
> +		    newParams.append("&amp;");
>  	    }
>  
>  	    // insert these parameters into the URL as
> appropriate
> @@ -167,7 +167,7 @@
>  		    return (url + "?" + newParams);
>  	        } else {
>  		    StringBuffer workingUrl = new
> StringBuffer(url);
> -		    workingUrl.insert(questionMark + 1,
> (newParams + "&"));
> +		    workingUrl.insert(questionMark + 1,
> (newParams + "&amp;"));
>  		    return workingUrl.toString();
>  	        }
>  	    } else {
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.