JSP页面无法跳转到指定页面
想通过判断输入的姓名重定向到指定页面,可点击提交后不会跳转,是不是哪里写错了,要在3-21.jsp页面显示得怎么写代码?
3-2.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP '3-2.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<form action="3-2.jsp" method="post">
请输入你的姓名:<input type="text" name="name">
<br>
请选择您的身份:
<input type="radio" name="job" value=“教师”>教师
<input type="radio" name="job" value=“学生”>学生
<input type="radio" name="job" value=“管理员”>管理员
<input type="hidden" name="toPost" value="p">
<input type="submit" value="提交" name="submit">
</form>
<%
request.setCharacterEncoding("utf-8");
String p = request.getParameter("toPost");
if(p!=null&&p.equals("p"))
{String str=null;
str=request.getParameter("boy");
if(str==null)
str="";
byte b[]=str.getBytes("ISO-8859-1");
str=new String(b);
if(str.equals(""))
response.sendRedirect("3-2.jsp");
else if(str.equals("教师")){
response.sendRedirect("3-21.jsp");
}
else if(str.equals("学生")){
response.sendRedirect("3-22.jsp");
}
else if(str.equals("管理员")){
response.sendRedirect("3-23.jsp");
}
}
%>
</body>
</html>
3-21.jsp
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP '3-21.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content=&