HttpServletRequest - Get query string parameters, no form data

JasonStoltz picture JasonStoltz · Jul 27, 2011 · Viewed 215.2k times · Source

In HttpServletRequest, getParameterMap returns a Map of all query string parameters and post data parameters.

Is there a way to get a Map of ONLY query string parameters? I'm trying to avoid using getQueryString and parsing out the values.

Answer

coastline picture coastline · Feb 12, 2014

You can use request.getQueryString(),if the query string is like

username=james&password=pwd

To get name you can do this

request.getParameter("username");