1
我正在配置彈簧安全性與我的彈簧應用程序。Login.jsp未與Spring安全性進行解析
下面是我httpsecurity配置
http.authorizeRequests()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.loginProcessingUrl("/login")
.permitAll()
.defaultSuccessUrl("/home")
.and()
.logout()
.logoutSuccessUrl("/login?logout");
下面是我的login.jsp
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %>
<html>
<body>
<h1 id="banner">Login to Security Demo</h1>
<form name="f" action="<c:url value='j_spring_security_check'/>"
method="POST">
<table>
<tr>
<td>Username:</td>
<td><input type='text' name='j_username' /></td>
</tr>
<tr>
<td>Password:</td>
<td><input type='password' name='j_password'></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan='2'><input name="submit" type="submit"> <input name="reset" type="reset"></td>
</tr>
</table>
</form>
</body>
</html>
的問題是現在顯示爲是當login.jsp的被擊中,我得到源代碼。當我刪除彈簧安全配置它工作並解析jsp頁面。
有人可以指出我的正確方向是什麼會導致此問題?
嗨Geditdk! ,對不起,我一直無法嘗試你的解決方案。但是我必須告訴你,你提到的代碼 是在login.jsp頁面中的,並且在我提交表單後就會生效。但實際上,我的問題是,登錄頁面顯示的源代碼,即JSP標籤本身如提到的問題,所以邏輯上不確定這是否會有所幫助! –
DragonZoned