exec.jsp文件为:
<%@page c%>
<html>
<head>
</head>
<body>
<%
java.util.Date d=new java.util.Date();
out.print(d);
%>
<form method="POST" action="action.jsp">
<p>用户名称:<input type="text" name="T1" size="20"></p>
<p> 密 码:<input type="password" name="T2" size="20"></p>
<input type="submit" value="登录" name="B1">
</form>
</body>
</html>
action.jsp文件为:
<%
String s1=request.getParameter("T1");
String s2=request.getParameter("T2");
if(s1.equals(s2))
{
out.print("Hello");
}
else
{
RequestDispatcher dispatcher = request.getRequestDispatcher("exec.jsp");
dispatcher.forward(request, response);
}
%>
[此贴子已经被作者于2010-12-12 08:16:34编辑过]