You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by johne <je...@yahoo.com> on 2008/06/30 06:46:52 UTC

URL encoding

Hey!

Progress!  I am wondering.  When I am creating a URL with a query string
using the Struts Link Tool, I am wondering what might affect the URL query
string to get the encoded version of an ampersand, not just a straight
ampersand.   When I am using the tool as is, I am getting a straight
ampersand which when I run it through the W3C validator tool, I get errors.

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.jobbank.com&charset=(detect+automatically)&doctype=Inline&group=0

For the suspect line I am using:
    $link.setAction( $!pop.rname Jobs 

I get:
    /action/pub/submit/job-listing?c=US&r=NJ New Jersey Jobs 


When I would want:
    /action/pub/submit/job-listing?c=US&amp;r=NJ New Jersey Jobs 

Which would not get errors.

-----
JohnE

http://www.jobbank.com jobbank.com 
-- 
View this message in context: http://www.nabble.com/URL-encoding-tp18188632p18188632.html
Sent from the Velocity - User mailing list archive at Nabble.com.


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


Re: URL encoding

Posted by johne <je...@yahoo.com>.
That was it!  That cleared up about 60 validation warnings from W3C
validation tests.  Thank you.  You can see the result already on
http://www.jobbank.com.  With that change, there is no need to change
DOCTYPE?   By the way, I could not find this on the velocity site.  Maybe I
missed it.  It was a good tip to know.

-----
JohnE

http://www.jobbank.com jobbank.com 
-- 
View this message in context: http://www.nabble.com/URL-encoding-tp18188632p18230926.html
Sent from the Velocity - User mailing list archive at Nabble.com.


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


Re: URL encoding

Posted by Christopher Schultz <ch...@christopherschultz.net>.
John,

johne wrote:
> Progress!  I am wondering.  When I am creating a URL with a query string
> using the Struts Link Tool, I am wondering what might affect the URL query
> string to get the encoded version of an ampersand, not just a straight
> ampersand.   When I am using the tool as is, I am getting a straight
> ampersand which when I run it through the W3C validator tool, I get errors.
> 
> http://validator.w3.org/check?uri=http%3A%2F%2Fwww.jobbank.com&charset=(detect+automatically)&doctype=Inline&group=0
> 
> For the suspect line I am using:
>     $link.setAction( $!pop.rname Jobs 
> 
> I get:
>     /action/pub/submit/job-listing?c=US&r=NJ New Jersey Jobs 
> 
> 
> When I would want:
>     /action/pub/submit/job-listing?c=US&amp;r=NJ New Jersey Jobs 


You want to add this to the end of your tookbol.xml file:

<xhtml>true</true>

This will configure LinkTool to emit URLs encoded appropriately for 
XHTML (which means using &amp; instead of just '&').

Hope that helps,
-chris