• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request.getParameter question

 
Chad Clites
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know I've seen this question answered somewhere before, but for the life of me I can't find it. Or I am not asking Google the correct question.

I have an HTML listbox from which a user can select an option. Some of the options have two or more words in them, so for instance, if my listbox held a list of bands, it might have Kiss, ACDC, The Clash, Violent Femmes, The Sex Pistols in the list. If my user is interested in learning about The Clash, the would select that from the listbox, and then click submit.

In my servlet, I use String band = request.getParameterValues("band");. I would expect band to hold The Clash, but instead it only holds The.

The API tells me that there is a getParameterValues that returns multiple values, but that appears to be only for instances like multiply selected checkboxes. getParameterNames returns an enumerator.

It would be simple enough to append the words with an underscore so that I had The_Clash. Although a simple fix, I am reasonably sure I saw some way to do this without doing any funky appending.

Best Regards
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm willing to bet that your HTML is malformed.... something like:



instead of the properly formed

 
Chad Clites
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hope you don't mind if I tip a glass of Courvoisier in your honor.... I can hardly believe I missed that..... You know the saying "Give a simple man a simple job and he'll simply screw it up"...

Sigh....

EDIT: In case I didn't make it clear.. thank you for helping this simple man with a simple problem....
[ June 21, 2006: Message edited by: Chad Clites ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64959
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd be more than happy for a beer to be tipped, but a good cognac is even better...

In other words, you're welcome.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic