关联就是了,一个变化触发另一个变化好像javascript 可以 实现!
解决方案 »
- 网页播放视频问题
- 用Resin部署不成功,有错误代码,跪求解决方法!
- hibernate session.save问题 (servlet中)
- 用Tomcat5.5发布的网站,如何不写项目名就能访问
- 孙卫琴:我为什么要写《Java面向对象编程》这本书
- 晕了晕了,如何利用unix+tomcat+jboss+struct做一个网站?只求相关源代码和相关资料。
- JSP/JAVA操作Excel的问题!在线等待!!!
- 怎么把form表单提交到一个新的窗口?
- spring+quartz动态任务报错请问为什么?????
- JSON响应格式
- 什么叫“http请求”,回答清楚了分可以再加。在线急等
- 帮我解一下吧,我都郁闷了好几天了,找不出什么原因?
DBConnect dbc=null;
ResultSet rs=null;
String sql=null;
String college=request.getParameter("college");
if(college!=null) college=college.trim();
String classname=request.getParameter("class_name");
String order=request.getParameter("order");
if(order==null)
order="stucode";
%>
<script language="javascript">
function jump(obj)
{
var url="class.jsp?college="+obj.options[obj.selectedIndex].value;
location.href=url;
}function jump2(obj)
{
var url="class.jsp?college="+form1.college.options[form1.college.options.selectedIndex].value+"&class_name="+obj.value;
location.href=url;
}
</script>
<%try
{
dbc=new DBConnect("user");%>
<form name="form1" action="post">
<%
if(sign!=2)
{
%>
<select name="college" onChange="jump(this)"><%
if(sign==0)
sql="select * from college";
else if(sign==1)
sql="select * from college where col_code='"+sign_s+"'";
rs=dbc.executeQuery(sql);
while(rs.next())
{
String code=rs.getString("col_code");
if(code!=null) code=code.trim();
String name=rs.getString("col_name").trim();
if(code!=null&&college==null) college=code;
if(code.equals(college))
out.println("<option selected value=\""+code+"\">"+name+"</option>");
else
out.println("<option value=\""+code+"\">"+name+"</option>");}
%></select>
<select name="classname" onChange="jump2(this)">
<option value="" >选择班级</option>
<%if(sign==0||sign==1)
sql="select * from class where col_code='"+college+"'";
if(college!=null)
{
rs=dbc.executeQuery(sql);
while(rs.next())
{
String class_code=rs.getString("ca_code").trim();
String class_name=rs.getString("ca_name").trim();
if(classname!=null&&classname.equals(class_code))
out.println("<option selected value=\""+class_code+"\">"+class_name+"</option>");
else
out.println("<option value=\""+class_code+"\">"+class_name+"</option>");
}
}
%>
</select>
<%
}
%>
</form>
</td>
</tr>
<tr>
<td height=30 colspan=11 valign="middle" bgcolor=#EFEFEF>
<div align="center">
<%
if(classname!=null&&(sign==0||sign==1))
{
sql="select * from student WHERE SUBSTRING(xuehao, 1, 5) = '"+classname+"'";
}
else
{
sql="select * from student WHERE SUBSTRING(xuehao, 1, 5) = '"+sign_s+"'";
classname=sign_s;
}
if(classname!=null)
{%>
<tr height="35" >
<td width="5%" height=35><div align="center">学号</div></td>
<td width="5%" height=35><div align="center">姓名</div></td>
<td width="2%"><div align="center">性别</div></td>
<td width="8%"><div align="center">出生日期</div></td>
<td width="10%"><div align="center">身份证</div></td>
<td width="8%"><div align="center">省份</div></td>
</tr>
<%
rs=dbc.executeQuery(sql);
while(rs.next())
{
String xuehao=rs.getString("xuehao");
String name=rs.getString("name");
String sex=rs.getString("sex");
String birthday=rs.getString("birthday");
String id_card=rs.getString("id_card");
String province=rs.getString("province");
if(name==null)
name="";
if(sex==null)
sex="没填写";
if(birthday==null)
birthday="没填写";
if(id_card==null)
id_card="没填写";
if(province==null)
province="没填写";
%>
<tr >
<td width="5%" height=35><div align="center"> <%= xuehao %></div></td>
<td width="5%" height=35><div align="center"> <%= name %></div></td>
<td width="5%"><div align="center"> <%= sex %></div></td>
<td width="5%"><div align="center"> <%= birthday %></div></td>
<td width="10%"><div align="center"> <%= id_card %></div></td>
<td width="8%"><div align="center"> <%= province %></div></td>
</tr>
<%
}
}
%>
</div>
</td>
</tr>
</table>
<%
}
catch(Exception e)
{
out.println(e.toString());
}
finally
{
if(dbc!=null)
dbc.close();
}%>