📄 loginhandler.jsp
字号:
<%@ page language="java" contentType="text/html;charset=Big5" %>
<%@ page import="LoginBean" %>
<%! private static final boolean DEBUG = false; %>
<jsp:useBean id="loginBean" scope="page" class="LoginBean" />
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=Big5">
<title>JavaBBS - LoginHandler</title>
</head>
<body>
<center>
<%
// Get params:
String acctName = request.getParameter("acct_name");
acctName = acctName.toUpperCase().trim(); // we should verify acctName (hold)
String password = request.getParameter("password"); // we should verify sPwdOrg (hold)
loginBean.setAcctName(acctName);
loginBean.setPassword(password);
if (loginBean.isLoginSuccess()) {
int nCustomerId = loginBean.fetchCustomerId();
session.setAttribute("customer_id", new Integer(nCustomerId));
String sTarget = (String) session.getAttribute("login.target");
// Redirect if needed:
if (sTarget != null)
try {
response.sendRedirect(sTarget);
} catch (IOException e) {
System.err.println("Err: " + e.getMessage());
}
// There should be no sTarget now:
out.println("Welcome! " + acctName);
} else {
out.println("Invalid Login");
}
%>
</center>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -