java - Update the default locale value by using properties file in Spring MVC -


my plan update default locale value in servlet-context.xml value of messages.properties file. verified other stackoverflow questions , other links well, not success.

servlet-context.xml is,

<context:property-placeholder location="c:\\users\\mahesh\\downloads\\springinternalization\\src\\main\\resources\\messages.properties" />  <!-- enables spring mvc @controller programming model --> <mvc:annotation-driven />     <mvc:resources mapping="/resources/**" location="/resources/" />   <!-- resolves views selected rendering @controllers .jsp resources      in /web-inf/views directory --> <bean     class="org.springframework.web.servlet.view.internalresourceviewresolver">     <property name="prefix" value="/web-inf/views/" />     <property name="suffix" value=".jsp" /> </bean>  <bean id="messagesource"     class="org.springframework.context.support.reloadableresourcebundlemessagesource">     <!-- <property name="basename" value="classpath:messages" /> -->     <property name="basenames">             <list>                 <value>classpath:messages</value>             </list>         </property>     <property name="defaultencoding" value="utf-8" />  </bean>   <bean id="localeresolver"     class="org.springframework.web.servlet.i18n.cookielocaleresolver">     <property name="defaultlocale" >     <value>${property.language}</value>     </property> </bean>   <!--   <mvc:interceptors>     <bean         class="org.springframework.web.servlet.i18n.localechangeinterceptor">         <property name="paramname" value="lang" />     </bean> </mvc:interceptors> --> <context:component-scan base-package="com.jocata.spring" /> 

please on guys. in advance. tried following,

use property file's property in spring mvc configuration servlet xml

what language file names? why need specify absolute path of properties file?

try this

<context:property-placeholder location="classpath:messages.properties" /> 

or use forward slash in file path

<context:property-placeholder location="file:c:/users/mahesh/downloads/springinternalization/src/main/resources/messages.properties" /> 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -