user419355
user419355

Reputation: 11

Multiple select how to capture all selections in java

I am using a multiple options select in my HTML form, when I select more than one option and use the 'GET' method in my form I see this

url?Ripples=1.3&Ripples=1.4

As you can see each selection has the same name, when I pass this to my jsp and display the variable I only get this first option which in this case is 1.3. How do I get all the selections into my java strings?

Upvotes: 1

Views: 459

Answers (4)

Kiran Pratap
Kiran Pratap

Reputation: 91

you can use

String[] ripples = request.getParameterValues("Ripples");

Upvotes: 4

JiminyCricket
JiminyCricket

Reputation: 7410

request.getParameterValues(argument) will return a list of the selected items.

Upvotes: 0

Maurice Perry
Maurice Perry

Reputation: 32831

request.getParameterValues("Ripples")

Upvotes: 0

Tushar Tarkas
Tushar Tarkas

Reputation: 1622

Ideally this should be handled by a POST request.

Upvotes: 0

Related Questions