Win a copy of Terraform in Action this week in the Cloud forum!

divya chaudhary

Greenhorn
+ Follow
since Jun 10, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by divya chaudhary

so everytime the mydropdown2 gets the value according to mydropdown1..the value selected in mydropdown1 gets lost..and the default value appears in mydropdown1
10 years ago
JSP
solution given above :

<form method = "POST" action = "Regester.do">

<select name="mydropdown1" onChange="location.href='Regester.jsp?option='+this.value">
<%@ page import= "java.util.*" %>
<%@ page import= "country.*" %>
<%
Countries countryBean = new Countries();
for (String s: countryBean.getCountries())
{
if(request.getParameter("option") != null && request.getParameter("option").equals(s))
out.println("<option value="+s+" selected=\"selected\">"+s+"</option>");
else
out.println("<option value="+s+">"+s+"</option>");
}
%>
</select>

<select name="mydropdown2">
<%
City cityBean = new City(request.getParameter("option"));
for(String s : cityBean.getCities())
out.println("<option value="+s+">"+s+"</option>");
%>
</select>
<input type ="SUBMIT">

</form>

--------------------------------------------------------------------
problem :
when i select a value from mydropdown1 , i want mydropdown2 to get the values according to the one selected in mydropdown1..
in the above code due to the line..
...
...onChange="location.href='Regester.jsp?option='+this.value
...

however the value in mydropdown2 changes (comes according to the value in mydropdown1)but the code cannot retain the value selected in mydropdown1 resulting in the loss of data

10 years ago
JSP
hii...i am also stuck to this problem while making a project on java..cant we store the values in request or session object to avoid the loss of data in fields..
somebody please help..
thanks in advance..
10 years ago
JSP
hii..me too interested to join d group.Infact i have started the preparation for it...so keen to join it soon..