I have URL like http://example.com/foo/?locale=en_US&xyz, when i do a getQueryString() on the URL i get back an empty String
I am doing "request.getQueryString()" on the URL
I have URL like http://example.com/foo/?locale=en_US&xyz, when i do a getQueryString() on the URL i get back an empty String
I am doing "request.getQueryString()" on the URL
getQuery() works for me:
String str = "http://example.com/foo/?locale=en_US&xyz";
URL url = new URL(str);
System.out.println(url.getQuery());
Output: locale=en_US&xyz
Doc says
Returns: a String containing the query string or null if the URL contains no query string. The value is not decoded by the container.
The value is not decoded by the container.
String queryString = URLDecoder.decode(request.getQueryString(), "UTF-8");
This will make getQueryString() work.
Recommend to get params using getParameter()
?is actually%3F(sometimes shown URL decoded in some browsers).