Meaningless Drivel is fun!*
The moose likes Servlets and the fly likes Retrieving multiple values from queryString Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Retrieving multiple values from queryString" Watch "Retrieving multiple values from queryString" New topic

Retrieving multiple values from queryString

r rafanan

Joined: Aug 04, 2005
Posts: 4
Does anybody have examples about how to retrieve multiple values from a query string?

I have a site

I can retrieve the whole query string


by the request.getQueryString() method. (I am using the java portlet api btw)

Does anyone have any examples of how I can a query string with multiple values in java?

I would like to be able to parse Parent=NewsSite&SiteArea=@NewsArea and retrieve the valeus NewsSite and NewsArea

Jeffrey Spaulding
Ranch Hand

Joined: Jan 15, 2004
Posts: 149
Look up request.getParameter() in the Servlet API Doc
r rafanan

Joined: Aug 04, 2005
Posts: 4
Problem solved! Here's a decent example on how to parse a query string with multiple values.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60766

All that is only necessary if you don't know what the names of the submitted parameters are. If you already know the names of the parameters that will be submitted, looping through an enumeration of the names is rather pointless.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
It is sorta covered in the JavaRanch Style Guide.
subject: Retrieving multiple values from queryString
Similar Threads
hows can i retrieve the values from a multiple select list in a jsp??
Query to not duplicate join results (resolved)
Give access to files only if the request comes from localhost
How to send back list of values from child window to parent window?