I have a url, something like this localhost:8080/foo.action?param1=7¶m2=8¶m3=6
When this is the Url (as it is), request.getParmeter("param2") gives me 8 [Correct]
i) When the encoding converts this url to localhost:8080/foo.action?param1=7%26param2=8%26param3=6
In this case, request.getParameter("param1") gives me 7¶m2=8¶m3=6
ii) When the encoding converts this url to localhost:8080/foo.action?param1=7&param2=8&param3=6
In this case, request.getParameter("param1") gives me 7 and request.getParameter("param2") gives me null
What is the correct way of retrieving the parameters? [Assuming that using one of the two Url encoding schemes is unavoidable]
(I am using struts actions)
You can call
req.getQueryString()to get the whole query parameters and then do server side decoding based on whatever encoding methods you choose.