I have 3 parameters in my URL. And I have encoded them using
URLEncoder.encode(myUrl,"UTF-8")
My url with encoded parameters looks like this
http://localhost/myPage.jsp%3Fparam1%3Daction%26param2%3D3%26param3%3Dhi
I specified pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"
in my jsp page and also set request.setCharacterEncoding("UTF-8")
before using request.getParameter("param1")
to get parameter value.
Still I only get the value of first param i.e param1. For other params I get null
But if I do double encoding(using URLEncoder.encode(myEncodedUrl,"UTF-8")
) I can get all three parameters' values. I guess double encoding is not the correct way to do it.
If I replace the &
with %2526
instead of %26
(actual encoded value of &
) I am getting value of all 3 params. I guess its not correct either.
Please let me know what I am missing in first place.