tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rashmi Rubdi <dev_subscripti...@yahoo.com>
Subject Re: [Fwd: Support for &amp; as a parameter separator in <c:url>]
Date Tue, 26 Sep 2006 11:08:52 GMT
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 <miki@ceti.pl> 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 <miki@ceti.pl>
> 
> > --- 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 

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


Mime
View raw message