1

I have a spring website that worked well. I decided to add a second language so I followed this tutorial http://www.mkyong.com/spring-mvc/spring-mvc-internationalization-example/ . The language change worked well however I encountered a strange problem. Some requests were still working but for others a 404 error of mapping not found occured and this for the two languages English and French. I really didn't understand the problem especially because not all of them stopped working but only some and I didn't change the mapping. When I delete the configuration lines of internationalization they work again. Here is the code : the dispatcher servlet :

<?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:p="http://www.springframework.org/schema/p"
       xmlns:aop="http://www.springframework.org/schema/aop"
       xmlns:tx="http://www.springframework.org/schema/tx"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd">


    <bean id="viewResolver"
          class="org.springframework.web.servlet.view.InternalResourceViewResolver"
          p:prefix="/WEB-INF/jsp/"
          p:suffix=".jsp" />

    <bean name="indexController"
          class="org.springframework.web.servlet.mvc.ParameterizableViewController"
          p:viewName="index" />

    <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
        <property name="basename" value="messages"/>
    </bean>

        <bean name="/index.htm" class="metier.IndexController"/>
  <bean name="/ajouterreservation.htm" class="metier.ReserverFormController">
        <property name="sessionForm" value="true"/>
        <property name="commandName" value="Réservation"/>
        <property name="commandClass" value="modele.Réservation"/>
         <property name="validator">
            <bean class="metier.ReservationValidator"/>
        </property>
        <property name="formView" value="FormulaireAjoutReservation"/>
        <property name="gestionPersonne" ref="gestionPersonne"/>
        <property name="gestionChambre" ref="gestionChambre"/>
    </bean> 

 <bean name="/jardins.htm" class="metier.JardinsController"/>
 <bean name="/divertissement.htm" class="metier.ActivitésController"/>
  <!-- Internationalization -->
 <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="language" />
    </bean>

    <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping" >
        <property name="interceptors">
           <list>
            <ref bean="localeChangeInterceptor" />
           </list>
        </property>
    </bean>
</beans>

The url index.htm and jardins.htm are still working however for divertissement.htm and ajouterreservation.htm I got this error : No mapping found for HTTP request with URI [/projetweb/divertissement.htm] in DispatcherServlet with name 'projetweb'

Fadhel55
  • 21
  • 3
  • I'm not sure if it helps, but a quick look on your configuration tells that it seems only the class with French characters in the config have problems. (Réservation, Activités). It might be a bug with Spring, but I think you should put English-only characters in the code. – Hoàng Long Feb 15 '15 at 14:32
  • Thanks for your answer . I replaced all french characters with English-only characters but it still doesn't work . I'm really astonished because as I said not all requests aren't working but some work and some don't . – Fadhel55 Feb 16 '15 at 16:23
  • I think you should try to enable logging for Spring and Spring Security, maybe there would be some clues. It depends on the lib you used, but I remember it's something like – Hoàng Long Feb 17 '15 at 17:34

0 Answers0