Spring Security 2.0.5。カスタムログインフォーム。英語以外の言語でエラーが表示されない

StackOverflow https://stackoverflow.com/questions/1636572

質問

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