Go4Expert

Go4Expert (http://www.go4expert.com/)
-   JSP (http://www.go4expert.com/forums/jsp/)
-   -   Passing an selected option to another jsp page (http://www.go4expert.com/forums/passing-selected-option-jsp-page-t21412/)

padmaharika 19Mar2010 13:06

Passing an selected option to another jsp page
 
Hello sir

I have created a dynamic dropdown box containing a list of states ,when i click a particular state it populates corresponding list of cities in another dropdown box.

Code:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript">
function setOptions(chosen) {
var selbox = document.myform.opttwo;
 
selbox.options.length = 0;
if (chosen == " ") {
  selbox.options[selbox.options.length] = new Option('Please select one of the options
above first',' ');
 
}
if (chosen == "1") {
  selbox.options[selbox.options.length] = new Option('hyderabad','hyd');
  selbox.options[selbox.options.length] = new Option('Secunderabad','sec');
}
}
</script>
</head>
<body>
<form name="myform"><div align="center">
STATE: <select name="optone" size="1"
onchange="setOptions(document.myform.optone.options[document.myform.optone.selectedIndex].value);">
<option value=" " selected="selected"> </option>
<option value="1">Andhra Pradesh</option>
<option value="2">Second Choice</option>
<option value="3">Third Choice</option>
</select><br /> <br />
CITY: <select name="opttwo" size="1">
<option value=" " selected="selected">Please select one of the options above first</option>
</select>
<input type="button" name="go" value="Click"
onClick="window.open('profile.jsp','mywindow','width=500,height=350,toolbar=no,resizable=yes,menubar=yes')">
</div></form>
</body>
</html>

Till here it working perfectly ,but when i go to profile.jsp page i want to display the name of the State and city i have selected.So please can u help me in teling how to pass the parameters to drop down box to another page .


All times are GMT +5.5. The time now is 05:19.