SPRING webmvc-config.xml是什么意思

时间:2014-07-17 09:15:00

标签: spring-mvc

请帮帮我!我修改了我的spring mwc应用程序。但我无法理解webmvc-config.xml文件中的一个标记是什么意思。我的意思是为什么它写成common.index而不是common / index?实际上在目录视图/ common中有文件index.jsp。

2 个答案:

答案 0 :(得分:0)

来自spring 3.0 documentation

  

此标记是用于定义ParameterizableViewController的缩写   在调用时立即转发到视图。在静态情况下使用它   在视图生成之前没有要执行的Java Controller逻辑时   回应

答案 1 :(得分:0)

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

    <mvc:annotation-driven />

    <!-- ================= MISC. ================= -->
    <!-- Message properties -->
    <bean id="messageSource"
        class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
        <property name="basenames">
            <list>
                <value>classpath:library</value>
            </list>
        </property>
    </bean>

    <!-- Declare the Interceptor -->
    <mvc:interceptors>
        <bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
            <property name="paramName" value="lang" />
        </bean>
    </mvc:interceptors>

    <!-- Declare the Resolver -->
    <bean id="localeResolver"
        class="org.springframework.web.servlet.i18n.SessionLocaleResolver" />

    <!-- Forwards requests to the "/" resource to the "home" view -->
    <mvc:view-controller path="/" view-name="common.index" />
    <mvc:view-controller path="/index.do" view-name="common.index" />
    <mvc:view-controller path="/common/ok.do"
        view-name="common.ok" />

    <mvc:view-controller path="/common/welcome.do"
        view-name="common.welcome" />

    <!-- Handles HTTP GET requests for /resources/** by efficiently serving 
        up static resources in the ${webappRoot}/resources/ directory -->
    <mvc:resources mapping="/resources/**" location="/resources/" />

    <!-- ================= TILES ================= -->
    <bean id="tilesConfigurer"
        class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
        <property name="definitions">
            <list>
                <value>/WEB-INF/spring/tiles-defs.xml</value>
            </list>
        </property>
    </bean>
    <bean id="tilesViewResolver"
        class="org.springframework.web.servlet.view.tiles3.TilesViewResolver" />

    <!-- ================= Upload Resolver (Roberto) ================= -->
    <bean id="multipartResolver"
        class="org.springframework.web.multipart.commons.CommonsMultipartResolver">

        <!-- one of the properties available; the maximum file size in bytes (1 MB)-->
        <property name="maxUploadSize" value="1048576" />
    </bean>

    <context:component-scan base-package="it.univaq.mwt.library.presentation" />
</beans>
相关问题