IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Web Java Discussion :

Problème internationalisation Spring MVC


Sujet :

Spring Web Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    28
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 28
    Par défaut Problème internationalisation Spring MVC
    Bonjour,

    Je réalise une application web ou j'utilise éclipse indigo, tomcat 7.0, Hibernate 4.1.1 et Spring 3.1.1.

    J'ai voulu mettre en place l'internationalisation. J'ai donc crée deux fichiers properties

    messages_en.properties
    messages_fr.properties

    Quand j’exécute mon programme et que je change de langue, il se passe rien. Je reste toujours en français et j'ai l'impression que seule le fichier messages_fr.properties est utilisé.

    fichier application-context.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
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    <?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:aop="http://www.springframework.org/schema/aop"
    	xmlns:context="http://www.springframework.org/schema/context"
    	xmlns:mvc="http://www.springframework.org/schema/mvc"
    	xmlns:tx="http://www.springframework.org/schema/tx"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
    		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
    		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
     
    	<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    		<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    		<property name="url" value="jdbc:mysql://localhost/hibernate"/>
    		<property name="username" value="root"/>
    		<property name="password" value="admin"/>
    	</bean>
     
    	<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    		<property name="dataSource" ref="dataSource"/>
    		<property name="annotatedClasses">
    			<list>
    				<value>app.model.FieldOwnedRecords</value>
    				<value>app.model.OwnRecord</value>
    				<value>app.model.Updatehistory</value>
    				<value>app.model.Evaluation</value>
    				<value>app.model.Soundtrack</value>
    				<value>app.model.Playlist</value>
    				<value>app.model.Comment</value>
    				<value>app.model.Field</value>
    				<value>app.model.Artist</value>
    				<value>app.model.AuthenticatedUser</value>
            		<value>app.model.Record</value>
    			</list>
    		</property>
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>	
    			</props>
    		</property>
    	</bean>
     
    	<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    		<property name="sessionFactory" ref="sessionFactory"/>
    	</bean>
     
    	<tx:annotation-driven transaction-manager="transactionManager"/>
    	<context:component-scan base-package="app" />
    	<context:annotation-config/>
    	<mvc:annotation-driven />
     
    	<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        	<property name="basename" value="classpath:messages" />
       		 <property name="defaultEncoding" value="UTF-8"/>
    	</bean>
     
     	<bean id="localeResolver"
    		class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
    		<property name="defaultLocale" value="fr" />
    	</bean>
     
    	<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
        	<property name="paramName" value="lang" />
    	</bean>
     
    	<bean id="handlerMapping" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
        	<property name="interceptors">
            	<ref bean="localeChangeInterceptor" />
        	</property>
    	</bean>
    </beans>

    fichier header.jsp

    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
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>
        <%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    	<meta charset="utf-8">
        <title>Vinyl Record Collection Manager</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="">
        <meta name="author" content="">
     
        <!-- styles -->
        <link href="bootstrap/css/bootstrap.css" rel="stylesheet">
        <style type="text/css">
          body {
            padding-top: 60px;
            padding-bottom: 40px;
          }
          .sidebar-nav {
            padding: 9px 0;
          }
        </style>
        <link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet">
     
        <!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
        <!--[if lt IE 9]>
          <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
        <![endif]-->
    </head>
     
    <body>
     
    <div class="navbar navbar-fixed-top">
      <div class="navbar-inner">
        <div class="container-fluid">
          <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
          <a class="brand" href="index.jsp">Vinyl Record Collection Manager</a>
          <div class="nav-collapse">
            <ul class="nav">
              <li><a href="index.jsp"><spring:message code="label.accueil"/></a></li>
              <li><a href="collection.html"><spring:message code="label.collection"/></a></li>
              <% 	if(session.getAttribute("nom") != null) out.println("<li><a href='userProfil.html'>Mon Profil</a></li>");
              		else {
              			out.println("<li><a href='userLogin.html'>Me Connecter</a></li>");
              			out.println("<li><a href='userRegister.html'>M'Inscrire</a></li>"); 
              		}%>
              		<p class="navbar-text pull-right">
        		<a href="?lang=fr">fr</a>
        |		<a href="?lang=en">en</a>
    		</p>
            </ul>
     
            <% if(session.getAttribute("nom") != null) out.println("<p class='navbar-text pull-right'>Connecté en tant que <a href='profil.jsp'>"+session.getAttribute("nom")+"</a>.  <a href='logout.jsp'>Déconnexion</a></p>");
            else out.println("<p class='navbar-text pull-right'>Vous n'êtes pas connecté. <a href='userLogin.html'>Connectez-vous</a></p>");%>
          </div><!--/.nav-collapse -->
        </div>
      </div>
    </div>
     
    <div class="container-fluid">
          <div class="row-fluid">
    merci d'avance

  2. #2
    Membre averti
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    28
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 28
    Par défaut
    Bonjour,

    Pour essayer de trouver l'erreur j'ai essayé de mettre le code lié à l'internationalisation dans mon fichier dispatcher-servlet.xml et pas dans le fichier application-context.xml mais cela m'a renvoyé une erreur.


    fichier dispatcher-servlet.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
    <?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:mvc="http://www.springframework.org/schema/mvc"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
    		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">
     
    	<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    		<property name="prefix" value="/"/>
    		<property name="suffix" value=".jsp"/>
    	</bean>
     
    	<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        	<property name="basename" value="classpath:messages" />
       		 <property name="defaultEncoding" value="UTF-8"/>
    	</bean>
     
    	<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
    	</bean>
     
    	<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
        	<property name="paramName" value="lang" />
    	</bean>
     
    	<bean id="handlerMapping" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
        	<property name="interceptors">
            	<ref bean="localeChangeInterceptor" />
        	</property>
    	</bean>
     
    </beans>
    trace tomcat :

    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
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    Etat HTTP 500 - 
     
    --------------------------------------------------------------------------------
     
    type Rapport d''exception
     
    message 
     
    description Le serveur a rencontré une erreur interne () qui l'a empêché de satisfaire la requête.
     
    exception 
     
    org.apache.jasper.JasperException: org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspTagException: No message found under code 'label.accueil' for locale 'fr_FR'.
    	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
     
     
    cause mère 
     
    org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspTagException: No message found under code 'label.accueil' for locale 'fr_FR'.
    	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:455)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
    	org.apache.jsp.index_jsp._jspService(index_jsp.java:65)
    	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
     
     
    cause mère 
     
    javax.servlet.ServletException: javax.servlet.jsp.JspTagException: No message found under code 'label.accueil' for locale 'fr_FR'.
    	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:911)
    	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:840)
    	org.apache.jsp.HeaderFooter.header_jsp._jspService(header_jsp.java:146)
    	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
    	org.apache.jsp.index_jsp._jspService(index_jsp.java:65)
    	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
     
     
    cause mère 
     
    javax.servlet.jsp.JspTagException: No message found under code 'label.accueil' for locale 'fr_FR'.
    	org.springframework.web.servlet.tags.MessageTag.doStartTagInternal(MessageTag.java:184)
    	org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
    	org.apache.jsp.HeaderFooter.header_jsp._jspx_meth_spring_005fmessage_005f0(header_jsp.java:165)
    	org.apache.jsp.HeaderFooter.header_jsp._jspService(header_jsp.java:110)
    	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
    	org.apache.jsp.index_jsp._jspService(index_jsp.java:65)
    	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
     
     
    note La trace complète de la cause mère de cette erreur est disponible dans les fichiers journaux de Apache Tomcat/7.0.26.
     
     
    --------------------------------------------------------------------------------
     
    Apache Tomcat/7.0.26

    trace eclipse :

    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
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    10 avr. 2012 09:34:46 org.springframework.web.servlet.tags.RequestContextAwareTag doStartTag
    GRAVE: No message found under code 'label.accueil' for locale 'fr_FR'.
    javax.servlet.jsp.JspTagException: No message found under code 'label.accueil' for locale 'fr_FR'.
    	at org.springframework.web.servlet.tags.MessageTag.doStartTagInternal(MessageTag.java:184)
    	at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
    	at org.apache.jsp.HeaderFooter.header_jsp._jspx_meth_spring_005fmessage_005f0(header_jsp.java:165)
    	at org.apache.jsp.HeaderFooter.header_jsp._jspService(header_jsp.java:110)
    	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
    	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
    	at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
    	at org.apache.jsp.index_jsp._jspService(index_jsp.java:65)
    	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    10 avr. 2012 09:34:46 org.apache.catalina.core.ApplicationDispatcher invoke
    GRAVE: "Servlet.service()" pour la servlet jsp a lancé une exception
    javax.servlet.jsp.JspTagException: No message found under code 'label.accueil' for locale 'fr_FR'.
    	at org.springframework.web.servlet.tags.MessageTag.doStartTagInternal(MessageTag.java:184)
    	at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
    	at org.apache.jsp.HeaderFooter.header_jsp._jspx_meth_spring_005fmessage_005f0(header_jsp.java:165)
    	at org.apache.jsp.HeaderFooter.header_jsp._jspService(header_jsp.java:110)
    	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
    	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
    	at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
    	at org.apache.jsp.index_jsp._jspService(index_jsp.java:65)
    	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)
    10 avr. 2012 09:34:46 org.apache.catalina.core.StandardWrapperValve invoke
    GRAVE: Servlet.service() for servlet [jsp] in context with path [/VinylRecordManager] threw exception [org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspTagException: No message found under code 'label.accueil' for locale 'fr_FR'.] with root cause
    javax.servlet.jsp.JspTagException: No message found under code 'label.accueil' for locale 'fr_FR'.
    	at org.springframework.web.servlet.tags.MessageTag.doStartTagInternal(MessageTag.java:184)
    	at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
    	at org.apache.jsp.HeaderFooter.header_jsp._jspx_meth_spring_005fmessage_005f0(header_jsp.java:165)
    	at org.apache.jsp.HeaderFooter.header_jsp._jspService(header_jsp.java:110)
    	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    	at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:593)
    	at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:530)
    	at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
    	at org.apache.jsp.index_jsp._jspService(index_jsp.java:65)
    	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
    	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
    	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
    	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
    	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:307)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    	at java.lang.Thread.run(Unknown Source)

  3. #3
    Membre éprouvé Avatar de chewing-gum
    Homme Profil pro
    Développeur Java
    Inscrit en
    Novembre 2009
    Messages
    105
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Novembre 2009
    Messages : 105
    Par défaut
    Dans ton bean "localeResolver", tu as oublié de définir le langage par défaut :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
    <property name="defaultLocale" value="fr" />
    </bean>
    Mais le reste de ta config m'a l'air correcte.

    EDIT : ou alors Spring ne trouve pas le fichier .properties dans ton classpath, d'où cette erreur. Vérifie que tes fichiers properties pour l'i18n sont dans ton classpath.

  4. #4
    Membre averti
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    28
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 28
    Par défaut
    J'ai défini le langage par défaut mais cela n'a rien changé. J'arrive à récupérer les messages en français mais je n'arrive pas a changer la langue pour passer en anglais. J'ai l'impression que le bean localeChangeInterceptor ne fonctionne pas correctement.

    Par exemple, lorsque je rajoute ?lang=en après l'url, la langue n'est pas changé.

  5. #5
    Membre éprouvé Avatar de chewing-gum
    Homme Profil pro
    Développeur Java
    Inscrit en
    Novembre 2009
    Messages
    105
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Java

    Informations forums :
    Inscription : Novembre 2009
    Messages : 105
    Par défaut
    Bon j'ai peut-être trouvé ton erreur.
    Apparemment, quand tu as plusieurs fichiers de propriétés, tu dois définir le bean "messageSource" de cette manière :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    	<bean id="messageSource"
    		class="org.springframework.context.support.ResourceBundleMessageSource">
    		<property name="basenames">
    			<list>
    				<value>classpath:messages</value>
                                    <value>classpath:otherMessages</value>
    			</list>
    		</property>
    	</bean>
    En bref, il faut ajouter une liste de valeurs qui pointent vers tes fichiers de propriétés.

    Par ailleurs, si ça ne marche toujours pas, essaye d'utiliser le "mvc interceptor" :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <mvc:interceptors>
        <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor"/>
    </mvc:interceptors>

  6. #6
    Membre averti
    Profil pro
    Inscrit en
    Avril 2010
    Messages
    28
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2010
    Messages : 28
    Par défaut
    J'ai résolu mon problème en utilisant <mvc:interceptors>

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Spring MVC] Problème d'encoding
    Par aloha dans le forum Spring Web
    Réponses: 6
    Dernier message: 22/11/2010, 14h56
  2. [Spring MVC] Problèmes avec SimpleFormController"s"
    Par SuperGandalf dans le forum Spring Web
    Réponses: 2
    Dernier message: 13/06/2007, 10h38
  3. [Spring MVC] problème SimpleFormController
    Par sothea dans le forum Spring Web
    Réponses: 1
    Dernier message: 15/05/2007, 17h38
  4. Réponses: 1
    Dernier message: 04/02/2007, 23h40
  5. [Spring MVC] Problème formulaire avec Collection
    Par arN34 dans le forum Spring Web
    Réponses: 1
    Dernier message: 16/09/2006, 13h17

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo