File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Retrieving multiple values from queryString" Watch "Retrieving multiple values from queryString" New topic
Author

Retrieving multiple values from queryString

r rafanan
Greenhorn

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

I have a site

http://www.x.com/test?Parent=NewsSite&SiteArea=@NewsArea

I can retrieve the whole query string

Parent=NewsSite&SiteArea=@NewsArea

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

Thanks,
Rolando.
Jeffrey Spaulding
Ranch Hand

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

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
Marshal

Joined: Jan 10, 2002
Posts: 61419
    
  67

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]
 
 
subject: Retrieving multiple values from queryString