This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes JSP and the fly likes & in url parameter value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "& in url parameter value" Watch "& in url parameter value" New topic

& in url parameter value

George Liao

Joined: May 20, 2003
Posts: 14
I have a java program to generate the URL in the jsp. The URL format is like¶2=value2. The value2 is like "home & address". When I use request.getParameter(�para2�), the return value is home, not home & address. In order to get "home & address",is anything I should do when I generate the URL? Thanks in advance.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Yes, you should URL Encode the names and values in the querystring so that they are not confused with control characters.

If you're building the querystring with Java on the server side, look at
[ June 05, 2008: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
George Liao

Joined: May 20, 2003
Posts: 14
Thanks Ben.
It is sorta covered in the JavaRanch Style Guide.
subject: & in url parameter value
It's not a secret anymore!