BeanNameViewResolver
As described in the documentation, BeanNameViewResolver
resolves View
s declared as beans. Usually you need it for some
special-purpose views.Imagine, for example, that one of your controllers should render an Excel spreadsheet. So, you
subclass AbstractExcelView
and implement your custom logic to render a spreadsheet based on model values:
public class MyExcelView extends AbstractExcelView { ... }
and declare it as a bean:
<bean id = "myExcelView" class = "MyExcelView" />
Then declaring an BeanNameViewResolver
makes it available to controllers: when controller returns ModelAndView
with view
name myExcelView
, your spreadsheet will be rendered.
BeanNameViewResolver
is usually used in conjunction with some other view resolver that handles "regular" views (so that
if BeanNameViewResolver
can't find a view, the other resolver tries to find it):
<bean class = "...BeanNameViewResolver">
<property name = "order" value = "0" />
</bean>
<bean class = "...InternalResourceViewResolver">
<property name = "order" value = "1" />
...
</bean>
BeanNameViewResolver的更多相关文章
- springmvc:BeanNameViewResolver访问内部资源视图对象和访问外部资源视图对象
<!-- 处理器映射器 --> <bean class="org.springframework.web.servlet.handler.SimpleUrlHandlerM ...
- SSM-SpringMVC-12:SpringMVC中BeanNameViewResolver这种视图解析器
------------吾亦无他,唯手熟尔,谦卑若愚,好学若饥------------- 视图解析器,这个很熟悉啊,之间就用过,就是可以简写/和.jsp的InternalResourceViewRes ...
- 基于BeanNameViewResolver解析器,自定义视图
概述 基于spring-mvc自定义视图,以BeanNameViewResolver作为解析器,以满足特殊需求. 本文以输出多个pdf文件的压缩文件,供前台下载的需求为例:但是不提供服务层实现. 实现 ...
- springboot easypoi 报错The bean 'beanNameViewResolver', defined in class path resource [cn/afterturn/e
事故现场: The bean 'beanNameViewResolver', defined in class path resource [cn/afterturn/easypoi/configur ...
- SpringMVC视图解析器
SpringMVC视图解析器 前言 在前一篇博客中讲了SpringMVC的Controller控制器,在这篇博客中将接着介绍一下SpringMVC视 图解析器.当我们对SpringMVC控制的资源发起 ...
- Handler
1.1 继承AbstractController优点:能定制请求方式 package cn.happyl.controller; import javax.servlet.http.HttpServl ...
- 深入理解Spring MVC
如何让一个普通类成为Controller? 方案一:实现接口Controller 解析:handleRequest(request,response) 方案二:继承AbstractController ...
- Spring Boot -- Start Up
做Java Web的同学,都知道项目启动需要放到servlet容器里面运行,无论是使用哪一款IDE,都是非常麻烦的一件事情.在很早之前,一个servlet容器下可以放下很多的项目,并一起运行,而到现在 ...
- SpingMVC 核心技术帮助文档
声明:本篇文档主要是用于参考帮助文档,没有实例,但几乎包含了SpringMVC 4.2版本的所有核心技术,当前最新版本是4.3,4.2的版本已经经是很新的了,所以非常值得大家一读,对于读完这篇文档感觉 ...
随机推荐
- 理解Null,Undefined,NAN
1.null表示尚未存在的对象,转为数值时为0.它表示"没有对象",即该处不应该有值,常用来表示函数企图返回一个不存在的对象.null是一种特殊的object(引用类型),代表一个 ...
- 洗衣店专用手持智能POS PDA手持设备 上门收衣 现场刷卡 打印票据 开单系统
手持上门收衣设备通过wifi或者3G手机卡等进行联网,功能便捷强大,多功能一体同步使用,通过手持机上门收.取衣物,快速开单收衣消费.取货.新建会员.现场办理会员发卡.手持机读发会员卡和会员用卡消费等. ...
- POJ2762 Going from u to v or from v to u?(判定单连通图:强连通分量+缩点+拓扑排序)
这道题要判断一张有向图是否是单连通图,即图中是否任意两点u和v都存在u到v或v到u的路径. 方法是,找出图中所有强连通分量,强连通分量上的点肯定也是满足单连通性的,然后对强连通分量进行缩点,缩点后就变 ...
- CSS3 box-shadow快速教程
box-shadow 属性向框添加一个或多个阴影.这个CSS3的属性很常用,盒阴影.按钮状态等各种地方都有用到,但是你了解并记住各个参数的作用及用法吗? 展示 源码:http://codepen.io ...
- CentOS6.4 安装LVS-RRD监控LVS
1.安装依赖包 yum install -y php httpd bc rrdtool 启动apache (我看网上的一些文档说不能用80端口,但我用80端口试了一下也好使,如果出现不好使的情况就改一 ...
- TYVJ P1069 cowtour 看不懂题意
描述 农民John的农场里有很多牧区.有的路径连接一些特定的牧区.一片所有连通的牧区称为一个牧场.但是就目前而言,你能看到至少有两个牧区通过任何路径都不连通.这样,农民John就有多个牧场了. Joh ...
- Dijkstra堆优化与SPFA模板
Dijkstra+优先队列 #include<cstdio> #include<cctype> #include<queue> #include<cstrin ...
- C++ Get Current Time 获取当前时间
在做项目中,我们经常需要获取系统的当前时间,那么如何获取呢,参见下面的代码: /* asctime example */ #include <stdio.h> /* printf */ # ...
- [转] - Ubuntu 安装Eclipse
昨天捣鼓一天,终于在Linux下成功安装Eclipse,这样,就能在Linux下像Windows的Visual Studio一样写程序了. 在网上搜索各种方法,但是没有一种方法是完整可行的,结合各种帖 ...
- extjs Combobox动态加载数据问题,mode:local 还是remote
var fabircTypeDs = new Ext.data.Store({ proxy: new Ext.data.HttpProxy({ url: 'province.do' }), reade ...