retreiving value from combobox in jsp

i have taken two combobox in my code , and i want to select the value from combobox. please anyone can help me out.
[122 byte] By [ama.banka] at [2007-11-27 0:14:22]
# 1
first, u need to select all the values which u want to retrieve. then u can get the values using request.getParameterValues() method. It returns a string array.
coolash920a at 2007-7-11 21:59:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
To fetch a selected value try this:var selectedValue = document.form.combobox.options[document.form.combobox.selectedIndex].valueORvar indexVal = combobox.selectedIndex;var SelectedVal = combobox.options[indexVal].value;
skp71a at 2007-7-11 21:59:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

[nobr]> i have taken two combobox in my code , and i want to

> select the value from combobox. please anyone can

> help me out.

<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head><title></title></head>

<body>

<form action="" method="post">

<fieldset>

<legend>My Combo Box Example:</legend>

<select name="myComboBox" multiple="multiple">

<option value="123">First Option</option>

<option value="456">Second Option</option>

<option value="789">Third Option</option>

</select>

<br/>

(Hint: Hold the Ctrl key to select multiple)

<br/><br/>

<input type="submit" name="submit" value="Submit This Form to Itself"/>

</fieldset>

</form>

<hr/>

<div>

<br/><br/>

Values Selected from the Combo Box are:<br/><br/>

<%

String[] myComboBoxValues = request.getParameterValues("myComboBox");

%>

<%

/*Short for loop syntax requires JDK 1.5 or higher*/

for (String myComboBox : myComboBoxValues) {

out.println(myComboBox);

out.println("<br/>");

}

%>

</div>

</body>

</html>

Note that I've use JSP Scriptlets for illustration purposes only. Now a better way to write JSPs is to use JSTL 1.1.x or higher tags.

Avoid Scriptlets , and use MVC framework , make use of Servlets and JavaBeans.[/nobr]

appy77a at 2007-7-11 21:59:36 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...