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
  • 相关阅读:
    贴现值计算
    基于“淘宝”的六种质量属性场景描绘
    Maven 学习笔记1
    酷客机器学习十讲笔记10
    酷客机器学习十讲笔记9
    酷客机器学习十讲8
    酷客机器学习十讲笔记7
    酷客机器学习十讲笔记6
    酷客机器学习十讲笔记5
    前后端分离项目学习笔记
  • 原文地址:https://www.cnblogs.com/yuyu666/p/10136112.html
Copyright © 2011-2022 走看看