1. ?xml version="1.0"encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:p="http://www.springframework.org/schema/p"
  5. xmlns:context="http://www.springframework.org/schema/context"
  6. xsi:schemaLocation="
  7. http://www.springframework.org/schema/beans
  8. http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  9. http://www.springframework.org/schema/context
  10. http://www.springframework.org/schema/context/spring-context-3.0.xsd">
  11. <context:component-scan
  12. base-package="com.spring.action" />
  13. <!--
  14. org.springframework.web.servlet.view.ResourceBundleViewResolver
  15. 用于多个视图集成时,ResourceBundleViewResolver是通过解析资源文件来解析请求输出文件的。
  16. <property name="basename"value="views"></property>,即表示在/WEB-INF/classes路径下有一个
  17. views.properties文件,本例中views.properties的内容为
  18. welcome.(class)=org.springframework.web.servlet.view.velocity.VelocityView
  19. welcome.url=welcome.vm
  20. freemarker.(class)=org.springframework.web.servlet.view.freemarker.FreeMarkerView
  21. freemarker.url=freemarker.ftl
  22. -->
  23. <bean class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
  24. <property name="basename" value="views"></property>
  25. <!--
  26. <property name="order"value="0"></property>
  27. -->
  28. </bean>
  29. <!-- jsp视图解析器 -->
  30. <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  31. <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
  32. <property name="prefix" value="/"/>
  33. <property name="suffix" value=".jsp"/>
  34. </bean>
  35. <!-- velocity视图解析器 -->
  36. <bean id="velocityViewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver">
  37. <property name="cache" value="true"/>
  38. <property name="prefix" value="/"/>
  39. <property name="suffix" value=".vm"/>
  40. </bean>
  41. <!-- velocity环境配置 -->
  42. <bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer">
  43. <!-- velocity配置文件路径 -->
  44. <property name="configLocation" value="/WEB-INF/velocity.properties"/>
  45. <!-- velocity模板路径 -->
  46. <property name="resourceLoaderPath" value="/WEB-INF/velocity/"/>
  47. </bean>
  48. <!-- FreeMarker环境配置 -->
  49. <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
  50. <!-- freemarker模板位置 -->
  51. <property name="templateLoaderPath" value="/WEB-INF/freemarker/"/>
  52. </bean>
  53. <!-- FreeMarker视图解析 -->
  54. <bean id="freeMarkerViewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
  55. <property name="cache" value="true"/>
  56. <property name="prefix" value="/"/>
  57. <property name="suffix" value=".ftl" />
  58. </bean>
  59. </beans>

SpringMvc多视图配置(jsp、velocity、freemarker) velocity在springmvc.xml配置VelocityViewResolver,VelocityConfigurer,FreeMarkerConfigurer,FreeMarkerViewResolver的更多相关文章

  1. springmvc 配置多视图(jsp,freemarker,HTML等)

    SpringMVC 的 Controller 可以返回各种各样的视图.比如 JSP, JSON, Velocity, FreeMarker, XML, PDF, Excel, 还有Html字符流 等等 ...

  2. SpringMVC 学习 八 SSM环境搭建(一) web.xml配置

    第一步:导入jar包 注意包的兼容性,以后采用maven会好很多 第二步:配置web.xml 在web.xml中,主要的配置内容有以下几点 (1)spring容器配置文件的位置 <!-- spr ...

  3. SpringMVC源码分析6:SpringMVC的视图解析原理

    title: SpringMVC源码分析6:SpringMVC的视图解析原理 date: 2018-06-07 11:03:19 tags: - SpringMVC categories: - 后端 ...

  4. 使用纯注解与配置类开发springMVC项目,去掉xml配置

    最近拜读了杨开振老师的书,深入浅出springBoot2.x,挖掘了很多以前被忽略的知识, 开发一年多,工作中一直用传统springmvc的开发,基本都还是用的传统的xml配置开发, 看到书里有提到, ...

  5. springmvc.xml和applicationContext.xml配置的特点

    1:springmvc.xml配置要点 一般它主要配置Controller的组件扫描器和视图解析器 下为:springmvc.xml文件 <?xml version="1.0" ...

  6. spring 5.x 系列第1篇 —— springmvc基础 (xml配置方式)

    文章目录 一.搭建hello spring工程 1.1 项目搭建 1.2 相关配置讲解 二.配置自定义拦截器 三.全局异常处理 四.参数绑定 4.1 参数绑定 4.2 关于日期格式转换的三种方法 五. ...

  7. SpringMVC、SpringMVC XML配置(纯XML方式)

    1.引入SrpingMVC所使用的Java包: cglib-nodep-2.1_3.jar.commons-logging.jar.spring-aspects-4.1.7.RELEASE.jar.s ...

  8. SpringBoot零XML配置的Spring Boot Application

    Spring Boot 提供了一种统一的方式来管理应用的配置,允许开发人员使用属性properties文件.YAML 文件.环境变量和命令行参数来定义优先级不同的配置值.零XML配置的Spring B ...

  9. Sping MVC不使用任何注解处理(jQuery)Ajax请求(基于XML配置)

    1. Spring Spring框架是一个轻量级的解决方案,是一个潜在的一站式商店,用于构建企业就绪的应用程序.Spring框架是一个Java平台,为开发Java应用程序提供全面的基础架构支持.Spr ...

  10. struts2 实现过程和xml配置

    实现过程: 当Web容器收到 请求(HttpServletRequest)它将请求传递给一个标准的的过滤链包括 (ActionContextCleanUp)过滤器,然后经过Other filters( ...

随机推荐

  1. linux通配符与正则表达式

    通配符   *  任意字符,可重复多次     ? 任意字符,重复一次     [] 代表一个字符 举例: [a,b,c] 表示abc中任意一个 通配符的作用是用来匹配文件名的 正则表达式 正则表达式 ...

  2. Longest Substring Without Repeating Characters2015年6月9日

    Given a string, find the length of the longest substring without repeating characters. For example, ...

  3. STM32串口控制步进电机(原创)

    用的42步进电机: 厂家可能不一样,两项四线步进电机,里面有两个线圈.在电机什么电都没有接的情况下,用万用表测量四个管脚:两两短接(或者阻值很小)的为一组,可以分别接A+,a-剩余接B+,B-;顺序可 ...

  4. python中的数字

    在编程中,通常使用数字来记录游戏得分,表示可视化数据.存储web应用信息等. #运算# 1,基本运算 >>> 2+35>>> 1-2-1>>> 3 ...

  5. c语言项目开发流程二部曲

    一.在第一部曲中我们介绍了电子词典项目开发的前5步,下面继续我们的步伐. 6.函数接口设计,这一步不是一蹴而就的,在项目进行中得不断修改,下面是我电子词典项目接口. /**************函数 ...

  6. css重构之旅

    css重构之旅 >前言: 今年我大一,马上就要大二了.从高三毕业暑假到大学的这一年马上过去,马上迎来大二生活学习前端也有将近一年了.一昧去追求那些视觉的效果和相对高端和新颖的技术,反而忽略了最基 ...

  7. Zepto源码分析-ajax模块

    源码注释 // Zepto.js // (c) 2010-2015 Thomas Fuchs // Zepto.js may be freely distributed under the MIT l ...

  8. javascript的八张图

  9. BOM(1)

    BOM 浏览器对象模型(Browser Object Model),使浏览器对象模型 (BOM) 使 JavaScript 有能力与浏览器"对话". 浏览器对象模型(Browser ...

  10. [Lucene]-Lucene基本概述以及简单实例

    一.Lucene基本介绍: 基本信息:Lucene 是 Apache 软件基金会的一个开放源代码的全文检索引擎工具包,是一个全文检索引擎的架构,提供了完整的查询引擎和索引引擎,部分文本分析引擎.Luc ...