jsp 联动菜单的跳转问题?
我用的是Js 控制跳转的,每跳转一次 就刷新一次页面。刷新之后 就得不到上次选的Option 值了?请求高手帮忙啊!
比如说 我选中”--武汉--“,就刷新一次页面,得到下拉菜单"汉口",但是 上个下拉菜单就不能保存--武汉--了?? ? ,我用 request 去请求 可是请求过来的值 是乱码。我做的是3级联动菜单,刷新第3次的时候,还是不能得到 request的值。
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="jdbc.Jdbc"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.util.Arrays"%>
<%@page import="com.sun.xml.internal.txw2.Document"%>
<%@page import="javax.swing.text.html.Option"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<script type="text/javascript">
function area(){
var vv = area_id.value;
var op=area_id.options[area_id.selectedIndex].text;
var url="jdbc.jsp?area="+vv+"&opptin="+op;
location.href=url;
}
function city(){
var vv = city_id.value;
var op=city_id.options[city_id.selectedIndex].text;
var url="jdbc.jsp?city_id="+vv;
location.href=url;
}
function school(){
var vv = school_id.value;
var op=school_id.options[school_id.selectedIndex].text;
var url="jdbc.jsp?school_id="+vv;
location.href=url;
}
</script>
<body >
<%jdbc.Jdbc jdbc= new Jdbc();
ResultSet rs =jdbc.getJdbc2();
%>
<br></br>
城市:
<select name="area_id" id="area_id" onchange="area()" style="width: 100px">
<option >
<%=request.getParameter("opptin") %>
</option>
<%
while(rs.next()){ //城市查询
%>
<option value="<%=rs.getString(1) %>" ><%=rs.getString(2) %></option>
<%} %>
</select>
<br></br>
区县:
<select id="city_id" name="city_id" onchange="city()" style="width: 150px">
<option></option>
<%String area_id =request.getParameter("area");
%>
<% if(area_id==null && "".equals(area_id)){%>
<option> 请选择 </option>
<%} else{%>
<% ResultSet rs2 = jdbc.getJdbc2("SUPERIOR",area_id);
while(rs2.next()){ //value 区域查询
%>
<option selected="selected" value="<%=rs2.getString("code") %>" > <%=rs2.getString(2)%> </option>
<%}
}
%>
</select>
<br></br>
学校:
<select id="school_id" name="school_id" onchange="school()" style="width: 150px">
<option></option>
<%String city_id =request.getParameter("city_id"); //学校查询
%>
<% if(city_id==null){%>
<%} else{%>
<% ResultSet rs3 = jdbc.getJdbc3("SZXQ",city_id);
while(rs3.next()){ %>
<option value="<%=rs3.getString("XXBH") %>" > <%=rs3.getString(5)%> </o