·进入 jsp_test 目录，在该目录建立 mypage11.jsp

<%@page contentType="text/html;charset=gb2312"%>

<%@ page import="java.util.*" %>

<html>

<head>

<title> 学习 JSP </title>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312"><style type="text/css">

<!--

body {

background-color: #CCCCCC;

}

-->

</style></head>

<body>

<table width="474" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#336699">

<tr>

<td width="470" bgcolor="#FFFFFF"><img src="images/rabbit.gif" width="468" height="60"></td>

</tr>

<tr>

<td height="144" bgcolor="#FFFFFF"><div align="center">

<FORM METHOD=POST ACTION="SaveName.jsp">

请输入你的名字? <INPUT TYPE=TEXT NAME=username SIZE=20>

<P><INPUT TYPE=SUBMIT value="确定">

</FORM>

</div></td>

</tr>

</table>

</body>

</html>

·在 jsp_test 目录，建立 SaveName.jsp

<%@ page contentType="text/html;charset=gb2312"%>

<%request.setCharacterEncoding("gb2312");%>

<html>

<head>

<title> 学习 JSP </title>

</head>

<body>

<%

String name = request.getParameter( "username" );

session.setAttribute( "theName", name );

%>

<A HREF="NextPage.jsp">继续</A>

</body>

</html>

·在jsp_test目录，建立NextPage.jsp

<%@ page contentType="text/html;charset=gb2312"%>

<html>

<head>

<title> 学习 JSP </title>

</head>

<body>

Hello, <%= session.getAttribute( "theName" ) %>

</body>

</html>

·在浏览器上打开下面连接

http://localhost:8080/jsp_test/mypage11.jsp