<!–
(adsbygoogle=window.adsbygoogle||[]).push({})
–>
(adsbygoogle=window.adsbygoogle||[]).push({})
<!–
–>
在前面的例子中,登陆页面都是用的Spring Security自己提供的,这明显不符合实际开发场景,同时也没有退出和注销按钮,因此在每次测试的时候都要通过关闭浏览器来注销达到清除session的效果。
login.jsp:
<%@ page language=\"java\" contentType=\"text/html; charset=utf-8\"
pageEncoding=\"utf-8\"%>
<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
<html>
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
<title>自定义登陆页面</title>
</head>
<body>
<div class=\"error ${param.error == true ? \'\' : \'hide\'}\">
登陆失败<br>
${sessionScope[\'SPRING_SECURITY_LAST_EXCEPTION\'].message}
</div>
<form method=\"post\" action=\"${pageContext.request.contextPath}/j_spring_security_check\" style=\"width:260px; text-align: center\">
<fieldset>
<legend>登陆</legend>
用户: <input type=\"text\" name=\"j_username\" style=\"width: 150px;\"
value=\"${sessionScope[\'SPRING_SECURITY_LAST_USERNAME\']}\" /><br />
密码: <input type=\"password\" name=\"j_password\" style=\"width: 150px;\" /><br />
<input type=\"checkbox\" name=\"_spring_security_remember_me\" />两周之内不必登陆<br />
<input type=\"submit\" value=\"登陆\" /> <input type=\"reset\" value=\"重置\" />
</fieldset>
</form> </body>
</html>
说明:
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
扫码联系技术微信【备注:站媒体网】
客服QQ:137483024







