Spring多视图解析器配置
来源:互联网 发布:金方 绿方 知乎 编辑:程序博客网 时间:2024/06/08 07:32
在SpringMVC模式当中可以通过如下配置来支持多视图解析
<!-- jsp jstl --> <bean id="JSPViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/> <property name="viewNames" value="*jsp" /> <property name="contentType" value="text/html; charset=utf-8"/> <property name="prefix" value="/" /> <property name="suffix" value="" /> <property name="order" value="1"></property> </bean>
<bean id="FMViewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.freemarker.FreeMarkerView"/> <property name="viewNames" value="*html" /> <property name="contentType" value="text/html; charset=utf-8"/> <property name="cache" value="true" /> <property name="prefix" value="/" /> <property name="suffix" value="" /> <property name="order" value="0"></property> </bean>
首先可以使用order属性进行设置 系统首先按解析器的order值进行查找 首先使用FreeMarkerViewResolver解析器调用canHandle方法,判断当前解析器对视图是否能够解析。如不能解析在依次调用。
最近被问到过几次关于springmvc多视图解析器解析的问题;总结一下。
假设我有两个jsp:
1 WEB-INF/html/a.jsp
2 WEB-INF/report/b.jsp
且我配置了视图解析器:
阅读全文
0 0
- [Spring]配置多个视图解析器
- Spring多视图解析器配置
- Spring MVC配置多视图解析器
- Spring MVC 中自定义视图 @Component 及 配置 多个视图解析器 Excel视图
- Spring MVC视图解析器:配置多个视图解析器的优先级
- Spring MVC视图解析器:配置多个视图解析器的优先级
- Spring MVC配置多个视图解析器(FreeMarker,JSP)
- Spring MVC 多个视图解析器配置
- freemarker、jsp多视图解析器Spring配置
- Spring不配置视图解析器问题
- spring配置freemarker视图解析器
- spring视图解析器
- spring学习笔记:配置视图解析器ViewResolver
- spring学习笔记:配置视图解析器ViewResolver
- Spring MVC Rest Json,XML多视图解析 配置
- Spring MVC Rest Json,XML多视图解析 配置
- spring-mvc多视图解析配置实例 ContentNegotiatingViewResolver
- Spring多视图配置
- 【云栖大会】阿里CTO张建锋:成立全球研究院达摩院 未来3年投1000亿
- 系统软件使用及常见报错
- http状态码汇总
- Thread的run()与start()的区别
- 解决Xcode 的"Could not insert new outlet connection"问题
- Spring多视图解析器配置
- Hbase Region迁移过程详解
- 认知自己,看清时代,反思未来!21世纪的学习方法
- SQL注入与防止
- navicat_premium12.0.11完美破解版(支持32位/64位)
- Nmon的安装及使用
- qemu 环境搭建
- [monitor] 3. Linux内核参数sysctl设置
- Java集合(一)---Java集合框架