2015-04-08 164 views
0

我在Spring,Spring Security,hibernate和primefaces中使用web應用程序。 的probleme是關於認證:當我不創建登錄頁面,春季安全自動創建一個和所有的工作很好,但我whene創建login.xhtml頁面,我得到這個錯誤:錯誤404 j_spring_security_check錯誤404 Spring Security 4.0 with primefaces

的login.xhtml頁面:

<form action="j_spring_security_check" method="POST"> 
<fieldset> 
    <legend>Connexion</legend> 
    <p> 
     <label>Login:</label> 
     <input type="text" name="j_username"/> 
    </p> 
    <p> 
     <label>Password:</label> 
     <input type="password" name="j_password"/> 
    </p> 
    <br/> 
     <input type="submit" value="Sign In"/> 

    </fieldset> 
</form> 

我的applicationContext.xml包含Spring安全配置在Web-Inf文件夾中,並且配置很好。

<s:http pattern="/resources/**" security="none" /> 
<s:http use-expressions="true"> 
    <s:intercept-url pattern="/login.xhtml" access="permitAll" /> 

    <s:intercept-url pattern="/admin/**" access="hasRole('ROLE_ADMIN')" /> 
    <s:intercept-url pattern="/nota/**" access="hasRole('ROLE_USER')" /> 
    <s:session-management> 
     <s:concurrency-control max-sessions="1" 
      error-if-maximum-exceeded="true" /> 
    </s:session-management> 
    <s:csrf disabled="true"/> 
    <s:form-login login-page="/login.xhtml" 
     authentication-failure-url="/login.xhtml" 
     authentication-success-handler-ref="myAuthenticationSuccessHandler" /> 
    <s:logout invalidate-session="true" delete-cookies="JSESSIONID" 
     logout-success-url="/login.xhtml" /> 
</s:http> 
<bean id="myAuthenticationSuccessHandler" 
    class="primefaces.test.authentification.MySimpleUrlAuthenticationSuccessHandler" /> 



<s:authentication-manager> 
    <s:authentication-provider> 
     <s:user-service> 
      <s:user name="jimi" password="jimi" authorities="ROLE_ADMIN" /> 
      <s:user name="bob" password="bobspassword" authorities="ROLE_USER" /> 
     </s:user-service> 
    </s:authentication-provider> 
</s:authentication-manager> 

任何人都可以幫助我嗎?請

+0

這是怎麼PrimeFaces相關型號?我只看到純html? – Kukeltje

+0

我已經使用primefaces組件登錄表單,但我得到了同樣的錯誤。 anayway,問題與primefaces或jsp或xhtml無關,但與資源j_spring_security_check – user3812197

+0

您的Spring Security配置是什麼樣的? –

回答

0

我決心改變春春秒版本3.2.4 問題所有做工精細