dcsimg
JSP Form Handling
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Friday, March 23, 2001 10:38 AM

How do I eliminate the spaces in the query string in a servlet /jsp combo
like I would replace them with %20 ?

Re: JSP Form Handling

Posted By:   Troy_Niven  
Posted On:   Sunday, March 25, 2001 12:29 PM

Use the

java.net.URLEncoder.encode()

method



just


import java.net.URLEncoder;

then use the method on the String you want encoded.

String temp1 = request.getParameter("something");
temp1=URLEncoder.encode(temp1);



The temp1 string will have it's spaces replaced with %20.

Please note that all other special characters will be URLEncoded as well.




LOGAN
About | Sitemap | Contact