URLEncoder - parameters in a jsp

i have a link like this:
http://localhost/here/jsp/userlogin.jsp

i need to pass the follwoing parameters in the url
nexturl=http://localhost/here/jsp/next.jsp?id=2&action=3

thus, the entire link becomes like this
http://localhost/here/jsp/userlogin.jsp?nexturl=http://localhost/here/jsp/next.jsp?id=2&action=3
right?
once the page userlogin is loaded, it get parameters nexturl and make a redirection to "nexturl"
What really happens is that the parameter "action=3" is lost and of course page is not exceuted as required
What should i do in this caseto avoid this
soamai_dmeetooAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
cheekycjConnect With a Mentor Commented:
try this:

nexturl = java.net.URLEncoder.encode("http://localhost/here/jsp/next.jsp?id=2&action=3");

CJ
0
 
cheekycjCommented:
Did that work for you?
0
 
soamai_dmeetooAuthor Commented:
yes thanks. i have try another thing : replacing the "&" by a "|". then replaces it back after getting the parameter. finally i have encoded the url
thanks for the help.
0
 
cheekycjCommented:
Glad I could help and Thanx for the "A".

CJ
0
All Courses

From novice to tech pro — start learning today.