This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

proper use of request.getParameterMap  RSS feed

 
G Raghavan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
while using request.getParameterMap() I am able to get the parameternames as the key. but how do i get the corresponding parametervalues which is returned as a single String.

thanx in advance
Raghavan
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the API - the map that getParameterMap returns has the name of the parameter as the key and a String array as the value. This array may be size 1 if there was only one parameter with this name, or it may be much larger if there were multiple parameters (for example from a bunch of checkboxes) with the same name.
Therefore you do something like:

(I was just now coding exactly that for a new test engine - how timely )
Working with this Map is the most general way to handle request values even though it takes an extra step.
Bill
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!