<%@ 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">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="lianxi6.jsp" method="post">
账号:<input type="text" name="name">
<br>
密码:<input type="password" name="password" >
<br>
<input type="submit" value="登录">
</form>
</body>
</html>
<%@ 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">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String name=new String (request.getParameter("name").getBytes("ISO-8859-1"),"UTF-8");
session.setAttribute("name", name);
String password=new String (request.getParameter("password").getBytes("ISO-8859-1"),"UTF-8");
session.setAttribute("password", password);
%>
登陆成功
<%
response.setHeader("refresh", "5;URL=lianxi7.jsp");
%>
</body>
</html>
<%@ 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">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
String name=session.getAttribute("name").toString();
String password=session.getAttribute("password").toString();
out.print("账号:"+name);
out.print("<br>密码:"+password);
%>
</body>
</html>
![](https://images2015.cnblogs.com/blog/917854/201606/917854-20160628092641359-1592354813.png)
![](https://images2015.cnblogs.com/blog/917854/201606/917854-20160628092659437-339521329.png)
![](https://images2015.cnblogs.com/blog/917854/201606/917854-20160628092713109-1532007522.png)