2

我的 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

4

1 回答 1

1

修复:

在我的 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>
于 2009-12-03T13:16:58.177 回答