如何使用Spring Security的
问题描述:
我想用标签<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 />
什么建议吗? 其我的感觉是,登录请求应通过控制器路由,然后我将能够访问资源包,但如何做到这一点?
答
将您的login.jsp放在WEB-INF目录下。
我现在正在无限循环.. – Rajesh 2012-08-07 12:22:18