zoukankan      html  css  js  c++  java
  • SpringMVC(二四) 视图解析流程

    目标方法无论返回的是string、ModelAndView、View,最终都被解析成modelAndView

    关键的实现代码是在springmvc.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"
        xmlns:context="http://www.springframework.org/schema/context"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
        xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd
            http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">
        
    <!--  配置自动扫描包 -->    
    <context:component-scan base-package="com.tiekui.springmvc.handlers"></context:component-scan>
    
    <!-- 配置视图解析器:如何把handler方法返回给视图 -->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/views/"></property>
        <property name="suffix" value=".jsp"></property>
    </bean>
    
    </beans>
    复制代码
    https://github.com/godmaybelieve
  • 相关阅读:
    解决Too many connections问题
    TPCC-MySQL安装、使用及结果解读
    Spring事务配置
    【转】Spring事务介绍
    Spring AOP的实现原理
    Spring AOP的使用
    Spring整合Junit4进行单元测试
    Spring Bean定义的三种方式
    spring集成Redis(单机、集群)
    Redis搭建(五):Cluster集群搭建
  • 原文地址:https://www.cnblogs.com/yuyu666/p/10136112.html
Copyright © 2011-2022 走看看