views:

491

answers:

1

Hello,

I've got my Spring Security custom login form working. It displays errors if the user has input bad credentials, or is expired, etc.

Looking inside spring-security-core-2.0.5.RELEASE.jar, I notice the following files in the org.springframework.security package:

messages.properties messages_cs_CZ.properties messages_de.properties messages_fr.properties ...etc...

and notice that they have the localised versions of the strings.

Setting my browser's preferred language to French doesn't make the French version of the string appear. What am I missing?

PUK

A: 

Fixed it:

In my applicationContext.xml I include the Spring Security messages by adding another basename:

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

In my web.xml I added another listener:

<listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
</listener>
PUK