Bonjour,

Impossible de faire fonctionner internationalisation sur spring 3 MVC

J'arrive à visualiser les message du fichier de langue message_fr.properties, paramétrage :
Code spring : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
<bean id="localeResolver"
    class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
    <property name="defaultLocale" value="fr"/>
</bean>

Mais impossible de changer de lang

Fichier : messageContext.xml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:task="http://www.springframework.org/schema/task"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
	http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
	http://www.springframework.org/schema/context 
	http://www.springframework.org/schema/context/spring-context-3.0.xsd
	http://www.springframework.org/schema/task 
	http://www.springframework.org/schema/task/spring-task-3.0.xsd">
 
 
	<bean id="messageSource"
    class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
    <property name="basename" value="classpath:messages" />
    <property name="defaultEncoding" value="UTF-8"/>
	</bean>
 
	<bean id="localeChangeInterceptor"
	    class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
	    <property name="paramName" value="lang" />
	</bean>
 
	<bean id="localeResolver"
	    class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
	    <property name="defaultLocale" value="fr"/>
	</bean>
 
	<bean id="handlerMapping"
	    class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
	    <property name="interceptors">
	        <ref bean="localeChangeInterceptor" />
	    </property>
	</bean>
</beans>
fichier : home.jsp
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
			<a href="?lang=en">Click to set English Language</a><br/>
			<a href="?lang=fr">Click to set French Language</a>
 
			<b><spring:message code="label.password"/></b>
Si vous avez une idée je suis preneur !!