<%@ page language= "java" contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>JSPforward動作實例</title>
</head>
<body>
<form action="CheckLogin.jsp" method=post>
<table>
<tr>
<td> 輸入用戶名</td>
<td><INPUT type =text name=name ></td>
</tr>
<tr>
<td> 輸入密碼</td>
<td><INPUT type =password name=password ></td>
</tr>
<tr colspan=2>
<td><INPUT type =submit value=登錄 ></td>
</tr>
</table>
</form>
</body>
</html>
——————————————————————————————————————————
<%@ page language= "java" contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>登錄檢測頁面</title>
</head>
<body>
<%--進行登錄檢測 --%>
<%
String name = request.getParameter("name");
String password = request.getParameter("password");
if(name.equals("lovo")&&password.equals("123")){
%>
<%-- --%>
<jsp:forward page="Success.jsp"/>
<%
}else{
%>
<jsp:forward page="JSPforwordLogin.jsp"/>
<%} %>
</body>
</html>
——————————————————————————————————————————
<%@ page language= "java" contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta charset="utf-8">
<title>登錄成功</title>
</head>
<body>
<H1>登錄成功</H1>
welcome!<%=request.getParameter("name") %>
</body>
</html>