求救!JSTL+Spring MVC国际化问题



如何实现让用户动态切换语言?

比如struts,通过在session里设定Locale属性。这样页面标签可以根据当前的Locale找到对应的国际化资源文件,显示相应的信息。

jstl也有类似的标签<fmt:message key=""/>,但是如何动态切换Locale呢?我试了一下<fmt:setLocale value=""/>标签,结果总是无效。显示的结果总是根据浏览器发送的请求头中支持的语言显示对应的国际化信息。比如,我把浏览器的语言设成英文,就会显示英文了。
这和Spring有关吗?应该怎么处理才能实现?

<beans>
<description>定义web层的资源,包括视图解析、URL和Controller的关系、消息配置等</description>

<bean id="propertyConfigurer"
class="com.paic.pafa.app.lwc.core.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location">
<description>可以引用CLASSPATH中context-paigreport.properties中定义的变量</description>
<value>classpath:context-paigreport.properties</value>
</property>
</bean>

<!--=====================================================================-->
<!-- 定义视图解析器,用哪种解析器来生成最终供用户显示的视图 -->
<!--=====================================================================-->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass">
<description>
使用Tiles来解析视图,Tiles用来组装页面视图,生成最终的HTML页面。
除了Tiles外,还可能用Excel、PDF等解析器。
</description>
<value>org.springframework.web.servlet.view.tiles.TilesJstlView</value>
</property>
</bean>

<bean id="tilesConfigurer"
class="org.springframework.web.servlet.view.tiles.TilesConfigurer">
<property name="definitions">
<list>
<value>/WEB-INF/tiles-defs.xml</value>
</list>
</property>
</bean> <bean id="messageSource"
class="org.springframework.core.context.support.ResourceBundleMessageSource">
<property name="basenames">

<list>
<value>message-error</value>
<value>message-info</value>
</list>
</property>
</bean> <bean name="/index.screen"
class="org.springframework.web.servlet.mvc.ParameterizableViewController">
<description>转到主页</description>
<property name="viewName">
<value>indexView</value>
</property>
</bean>
<bean name="/error.screen"
class="org.springframework.web.servlet.mvc.ParameterizableViewController">
<description>转到出错的页面</description>
<property name="viewName">
<value>errorView</value>
</property>
</bean>
.....

</beans>