File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "& in url parameter value" Watch "& in url parameter value" New topic
Author

& in url parameter value

George Liao
Greenhorn

Joined: May 20, 2003
Posts: 14
I have a java program to generate the URL in the jsp. The URL format is like www.mydomain.com/?para1=value1¶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
Sheriff

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 java.net.URLEncoder.
[ 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
Greenhorn

Joined: May 20, 2003
Posts: 14
Thanks Ben.
 
jQuery in Action, 2nd edition
 
subject: & in url parameter value
 
Similar Threads
doGet and doPost
jsp:include & jsp:param
url attribute of <h:graphicImage/> not accepting 2nd request parameter
Ampsersand in url
how to use sessions in shopping cart like application