Reputation: 37
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
Upvotes: 0
Views: 1774
Reputation: 10112
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()
Upvotes: 1
Reputation:
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
Upvotes: 1