我正在尝试这个dispacther servlet xml文件
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"
xmlns:p="http://www.springframework.org/schema/p">
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix">
<value>/WEB-INF/jsp/</value>
</property>
<property name="suffix">
<value>.jsp</value>
</property>
</bean>
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="interceptors">
<list>
<ref local="localeChangeInterceptor"/>
</list>
</property>
<property name="urlMap">
<map>
<entry key="/hello.html">
<ref bean="helloController"/>
</entry>
</map>
</property>
</bean>
<bean id="helloController" class="net.roseindia.web.HelloWorldController"></bean>
<bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
<property name="paramName" value="hl"/>
</bean>
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver"/>
</beans>
我无法理解像
这样的事情<property name="interceptors">
<list>
<ref local="localeChangeInterceptor"/>
</list>
</property>
拦截器的功能是什么,localeChangeInterceptor
是什么?这个区域解析器也是什么?
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver"/>
答案 0 :(得分:1)
Spring Reference中描述了这些组件的功能,请参阅15.6 Using locales。
LocaleResolver
确定用户区域设置LocaleChangeInterceptor
允许用户手动更改其区域设置