S
Santosh
Hi,
Here is a brief description of what my prblem is:
I have a Combo box in a jsp page that is populated from the database.
The following code snippet shows how i am populating the combo box.
//data from the database is there in an Enumeration object tempEnum
Integer tempInt;
int tempctr=0;
while(tempEnum.hasMoreElements()){
tempInt=((Integer)tempEnum.nextElement());
tempctr++;
%>
<option value="<%=tempctr%>"><%=tempInt.toString()%></option>
<%
}
%>
I am using a counter (tempctr) to set the values of the combo box
option as I will need that for further calculations.
My Question:
I, not only need to know the option value that is selected, I also
need to know the option that is selected.
say for example if the output of the combo box after being populated
is:
<select name="select">
<option value="1">3</option>
<option value="2">6</option>
<option value="3">8</option>
<option value="4">9</option>
<option value="5">10</option>
</select>
In the above case, if the user selects the 3rd option:
<option value="3">8</option>
I want to read the value (3 in this case) and also the option (8). How
can I do that using ServletRequest object? Right now I am able to read
the value by calling:
request.getParameter("select");
I am newbie to java so please excuse my ignorance.
-Santosh
Here is a brief description of what my prblem is:
I have a Combo box in a jsp page that is populated from the database.
The following code snippet shows how i am populating the combo box.
//data from the database is there in an Enumeration object tempEnum
Integer tempInt;
int tempctr=0;
while(tempEnum.hasMoreElements()){
tempInt=((Integer)tempEnum.nextElement());
tempctr++;
%>
<option value="<%=tempctr%>"><%=tempInt.toString()%></option>
<%
}
%>
I am using a counter (tempctr) to set the values of the combo box
option as I will need that for further calculations.
My Question:
I, not only need to know the option value that is selected, I also
need to know the option that is selected.
say for example if the output of the combo box after being populated
is:
<select name="select">
<option value="1">3</option>
<option value="2">6</option>
<option value="3">8</option>
<option value="4">9</option>
<option value="5">10</option>
</select>
In the above case, if the user selects the 3rd option:
<option value="3">8</option>
I want to read the value (3 in this case) and also the option (8). How
can I do that using ServletRequest object? Right now I am able to read
the value by calling:
request.getParameter("select");
I am newbie to java so please excuse my ignorance.
-Santosh