Been looking everywhere, I just can’t seen to find it (probably because I’m wording it wrong or something).
In have a simple select tag in a from with several options. Each option has an id attribute. I want to get the id from the selected options.
The name of the select tag is “group”, so in the servlet I call:
String group = request.getParameter("group");
This only returns the “label” of the option (the name of it, what the user sees). I don’t want that, I want the id of it. I tried
String group = request.getParameterValues("group");
but that just returns an array with one item, the label of the option.
How can I do this? Thanks.
You should set the
valueattribute of theoptiontag to what you want to get from servlet: