<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>3-2.jsp</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="post" value="p"/>
<input type="submit" value="提交" name="submit">
</form>
<%
request.setCharacterEncoding("utf8");
String p = request.getParameter("post");
if(p!=null&&p.equals("p"))
{
String job=request.getParameter("job");
String str=request.getParamete机械厂35/366KV总降压变电所设计r("name");
if( str==null)
{
str = "";
}
System.out.println(job);
if(job.equals(""))
{
response.sendRedirect("3-2.jsp");}
else if(job.equals("教师")){
response.sendRedirect("3-21.jsp?name="+str);
}
else if(job.equals("学生")){
response.sendRedirect("3-22.jsp?name="+str);
}
else if(job.equals("管理员")){
response.sendRedirect("3-22.jsp?name="+str);
}
}
%>
</body>
</html>
3-21.jsp
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
request.setCharacterEncoding("utf-8");
String name = request.getParameter("name");
%>
<%=name %> <br>
注意request.setCharacterEncoding("utf-8");和你的pageEncoding="utf-8"一样