日期:2014-05-18  浏览次数:20564 次

jsp 页面跳转问题(在线等)请哪位高手指教???
在choose.jsp页面中有两个下拉菜单框,我想在display.jsp页面中,根据choose.jsp页面中获取的两个字段,来实现跳转不同的页面,不知道怎么搞?请高手指教
还有一个问题,就是我在display中用request.getparameter为什么获取不到前面下拉框的信息呢??

------解决方案--------------------
1.通过脚本实现,
例:location.href = "*.jsp?参数名=参数值 "

2.确认你是否有传递参数到display.jsp中,同时确认参数名是否相对应
------解决方案--------------------
*************choose.jsp*****************

<%@ page language= "java " import= "java.util.* " pageEncoding= "GBK "%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">
<html>
<head>
<title> My JSP 'choose.jsp ' starting page </title>
</head>
<body>
跳转到:
<select name= "page "
onchange= "navigate( 'display.jsp?opt= '+this.value); ">
<option value= "p1 " selected= "selected ">
页面1
</option>
<option value= "p2 ">
页面2
</option>
</select>
</body>
</html>

*************display.jsp*****************

<%@ page language= "java " import= "java.util.* " pageEncoding= "GBK "%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN ">
<html>
<head>
<title> My JSP 'display.jsp ' starting page </title>
</head>
<body>
<%
if(null!=request.getParameter( "opt "))
{
if(request.getParameter( "opt ").equals( "p1 "))
{
response.sendRedirect( "aaa.jsp ");
}
else if(request.getParameter( "opt ").equals( "p2 "))
{
response.sendRedirect( "bbb.jsp ");
}
}
%>
</body>
</html>