Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Getting list of parameters from POST - JSP  RSS feed

 
Steve Wood
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,
I have a JSP page that will have a varying number of form parameters. I need to get these values from the form, but can't work out how to do it. I realise I can use some nifty parameter methods for a GET (enumerating through the values and names etc), but what do I do for POST? I'm a bit new to JSP and any assistance would be great.
I would use a GET, but the text enterred on the form will likely be too long and I've already hit a few problems (hence the post - pardon the pun).
Thanks in advance,
Steve
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should be able to use exactly the same techniques as you would use for the GET request. The servlet/JSP container does all the parameter parsing for you, and presents a uniform interface to your code.
Have you tried just changing the "method" to "POST" in yout HTML and seeing if the old GET code still works?
 
Steve Wood
Ranch Hand
Posts: 137
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Frank, that appears to have worked. I didn't realise you could access POST parameters that way - you learn something everyday... (Maybe I should do more reading).
Cheers,
Steve
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!