login.jsp

来自「一本关于EJB的书」· JSP 代码 · 共 68 行

JSP
68
字号
<%--
 This JSP displays a login screen.  When the user fills out
 the login screen, it will submit it to the Login Servlet,
 which will verify the user's credentials by calling
 EJB components.
 
 if verification is unsuccessful, the login servlet will return
 the user to this page to re-enter his credentials.
 
 if verification is successful, Jasmine's main page will be
 displayed.
--%>

<html>
<head>
 <title>Jasmine's Login page </title>
</head>

<body>

<%-- Include the title, which is "Jasmine's Computer Parts"--%>
<jsp:include page="title.jsp" />

<%-- Indicate the error page to use if an error occurs --%>
<jsp:directive.page errorPage="error.jsp" />

<%-- Display the login form --%>
<h4>Please Login<h4>
<p>
<form action="/jasmine/login" method="get">
 <table>
  <tr>
   <td><b>Name:</b></td>
   <td>
    <input type="text" name="Login" value="Ed Roman" size="19">
   </td>
  </tr>
  <tr>
   <td><b>Password:</b></td>
   <td>
    <input type="text" name="Password" value="password" size="19">
   </td>
  </tr>
  <tr>
   <td></td>
   <td>
    <input type="submit" value="Submit Information">
   </td>
  </tr>
 </table>
</form>

<%
 // get whether the person logged in successfully
 Boolean failed = (Boolean) request.getAttribute("loginFailed");
 if (failed != null) {
  if (failed.booleanValue() == true) {
%>
  <p>
  <strong>Could not log in!  Please try again.</strong>
  <p>
<%
  }
 }
%>

</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?