Skip to content

Instantly share code, notes, and snippets.

@LuckyKoala
Created May 30, 2017 03:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LuckyKoala/5c5508375710bc2f506d9978566d24be to your computer and use it in GitHub Desktop.
Save LuckyKoala/5c5508375710bc2f506d9978566d24be to your computer and use it in GitHub Desktop.
Simple jsp for user login
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<jsp:useBean id="loginBean" class="javabean.LoginBean" scope="session"/>
当前用户: <%= loginBean.getUname() %>[UUID: <%= loginBean.getUuid() %>]
最近一次登录状态: <%= session.getAttribute("loginMessage") %>
<%
if(loginBean.getHasLogin()) {
%>
<a href="login?loginOperator=LOGOUT&srcPage=<%= request.getParameter("srcPage") %>">注销</a>
<%
} else {
%>
<form action="login" name="loginForm" method="post">
<input type="hidden" name="srcPage" value="<%= request.getParameter("srcPage") %>">
<input type="hidden" name="loginOperator" value="LOGIN">
用户名: <input type="text" name="userName">
密码: <input type="password" name="password">
<input type="submit" value="登录">
</form>
<%
}
%>
<hr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment