This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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


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: 63208
    
  69

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]
 
Have you checked out Aspose?
 
subject: Retrieving multiple values from queryString
 
It's not a secret anymore!