这是一个简单登陆的程序,先执行login.jsp 输入“abc”后点“确定”,没有转入ok.html。为什么?谢谢~~
login.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
</head>
<body>
<center>
<form method=get action="test.jsp">
username<input type=text name=username>
<br><br>
<input type=submit value="确定">
</form>
</center>
</body>
</html>
test.jsp
<%@ page contentType="text/html; charset=gb2312" language="java" errorPage="" %>
<html>
<body>
<%
string username=request.getparameter("username");
if(username.trim().equals("abc"))
{%>
<jsp:forward page="ok.html" />
<%}
else
{%>
<jsp:forward page="no.html" />
<%}
%>
</body>
</html>
ok.htm
<html>ok</html>
no.htm
<html>no</html>
[此贴子已经被作者于2007-11-18 9:52:05编辑过]