?? ch3-12.jsp
字號:
<html>
<head>
<title>登錄-讀取Session</title>
</head>
<BODY bgcolor="#FFFF99">
<%@ page contentType="text/html; charset=gb2312" %>
<%!
String name;
String mima;
String name2;
String mima2;
%>
<%
request.getSession(true);
if(session.getValue("user")==null)
{
out.print("<h2>你沒有注冊,不能登錄!</h2><P>");
out.print("<a href='ch3-11.htm'>去注冊</a>");
return;
}
name=request.getParameter("text");
mima=request.getParameter("password");
name2=(String)session.getValue("user");
mima2=(String)session.getValue("pass");
if(name.equals(name2) && mima.equals(mima2))
response.sendRedirect("ch3-13.jsp");
else if(!name.equals(name2) || !mima.equals(mima2))
out.println("<h2>登錄失敗!</h2>");
response.sendRedirect("ch3-14.jsp");
%>
</BODY>
</HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -