Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Retrieving multiple values from queryString

 
r rafanan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look up request.getParameter() in the Servlet API Doc
 
r rafanan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem solved! Here's a decent example on how to parse a query string with multiple values.

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64972
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic