我的Spring Security自定义登录表单正常运行。如果用户输入了错误凭据或已过期等,则会显示错误

查看spring-security-core-2.0.5.RELEASE.jar,我注意到org.springframework.security包中的以下文件:

messages.properties messages_cs_CZ.properties messages_de.properties messages_fr.properties ...等等...

并注意到他们有字符串的本地化版本。

将浏览器的首选语言设置为法语不会使字符串的法语版本显示。我错过了什么?

PUK

有帮助吗?

解决方案

修正了它:

在我的applicationContext.xml中,我通过添加另一个基本名称来包含Spring Security消息:

<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
    <property name="basenames">
        <list>
            <value>com.myapp.web.my_messages</value>
            <value>org.springframework.security.messages</value>
        </list>
    </property>
</bean>

在我的web.xml中,我添加了另一个监听器:

<listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top