2012-08-07 89 views
0

我想用標籤<spring:message code="login.name" />使用資源包在登錄頁面 訪問資源包在登錄頁面的Spring應用程序,但我得到的錯誤作爲如何使用Spring Security的

No message found under code 'login.name' for locale 'en_US'. 

我在下面提及這個答案,但它不適合我。 Can I use in Spring the Message Resource Bundle when calling a JSP directly

這是一個樣品從我的春天剪斷的security.xml

<sec:global-method-security pre-post-annotations="enabled" /> 

    <sec:http pattern="/css/**" security="none"/> 
    <sec:http pattern="/images/**" security="none"/> 
    <sec:http pattern="/js/**" security="none"/> 
    <sec:http pattern="/index.jsp" security="none"/> 
    <!-- <sec:http pattern="/app/addNewUser.json" security="none"/> --> 
    <sec:http pattern="/login.jsp" security="none"/> 
    <sec:http use-expressions="true"> 

     <!-- 
      Allow all other requests. In a real application you should 
      adopt a whitelisting approach where access is not allowed by default 
      --> 
     <sec:intercept-url pattern="/**" access="isAuthenticated()" /> 
     <sec:form-login login-page='/login.jsp' 
      authentication-failure-url="/login.jsp?login_error=1" 
      default-target-url="/index.jsp" /> 
     <sec:logout logout-success-url="/login.jsp" delete-cookies="JSESSIONID"/> 
     <sec:remember-me /> 

什麼建議嗎? 其我的感覺是,登錄請求應通過控制器路由,然後我將能夠訪問資源包,但如何做到這一點?

回答

0

將您的login.jsp放在WEB-INF目錄下。

+0

我現在正在無限循環.. – Rajesh 2012-08-07 12:22:18