aspose file tools*
The moose likes Servlets and the fly likes request.getParameter question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "request.getParameter question" Watch "request.getParameter question" New topic
Author

request.getParameter question

Chad Clites
Ranch Hand

Joined: Aug 16, 2005
Posts: 134
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

Joined: Jan 10, 2002
Posts: 60057
    
  65

I'm willing to bet that your HTML is malformed.... something like:



instead of the properly formed



[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Chad Clites
Ranch Hand

Joined: Aug 16, 2005
Posts: 134


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

Joined: Jan 10, 2002
Posts: 60057
    
  65

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: request.getParameter question
 
Similar Threads
Culture Clash
Clash of Civilizations!!