开发者

Need some help with dispatcher-servlet xml file

I am trying this dispacther servlet xml file

<?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.springfra开发者_运维技巧mework.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>

I could not understand few things like

<property name="interceptors">
    <list>
        <ref local="localeChangeInterceptor"/>
    </list>
</property>

What is the function of a interceptor and what is localeChangeInterceptor? Also what is this locale resolver?

<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver"/>


Functions of these components are described in Spring Reference, see 15.6 Using locales.

  • LocaleResolver determines the user locale
  • LocaleChangeInterceptor allows user to change its locale manually
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜