springmvc 中controller与jsp传值
参考:springmvc 中controller与jsp传值
springMVC:将controller中数据传递到jsp页面
jsp中,死活拿不到controller中的变量。
花了半天,网上列出各种原因。最后发现,是自己对springmvc中controller和jsp的传值不理解导致
controller的方法中需要返回Model的,这点是springmvc和struct的不同
第二种方法无法返回,后续再探究为啥
//列表
@RequestMapping("/listAll")
public String listAll(Map<String,Object> model){
List<Person> personList = ps.listAll();
model.put("personList", personList); System.out.println(" listall hello"); return "person/jPersonList";
} //列表
@RequestMapping("/listAllOther")
public String listAllOther(Model model){
List<Person> personList1 = ps.listAll();
model.addAttribute(personList1); System.out.println(" listallother1 hello"); return "person/jPersonList";
}
springmvc 中controller与jsp传值的更多相关文章
- springMVC中controller的几种返回类型
==网文1,还不错,感觉比较老旧springMVC中controller的几种返回类型 - CSDN博客http://blog.csdn.net/qq_16071145/article/details ...
- SpringMVC中controller返回图片(转)
本文转自:http://blog.csdn.net/u011637069/article/details/51112187 SpringMVC中controller通过返回ModelAndView然后 ...
- 详解SpringMVC中Controller的方法中参数的工作原理[附带源码分析]
目录 前言 现象 源码分析 HandlerMethodArgumentResolver与HandlerMethodReturnValueHandler接口介绍 HandlerMethodArgumen ...
- SpringMVC中Controller
详解SpringMVC中Controller的方法中参数的工作原理[附带源码分析] 目录 前言 现象 源码分析 HandlerMethodArgumentResolver与HandlerMethodR ...
- 详解SpringMVC中Controller的方法中参数的工作原理——基于maven
转自:http://www.tuicool.com/articles/F7byQn 前言 SpringMVC是目前主流的Web MVC框架之一. 如果有同学对它不熟悉,那么请参考它的入门blog:ht ...
- 【MVC - 参数原理】详解SpringMVC中Controller的方法中参数的工作原理[附带源码分析]
前言 SpringMVC是目前主流的Web MVC框架之一. 如果有同学对它不熟悉,那么请参考它的入门blog:http://www.cnblogs.com/fangjian0423/p/spring ...
- SpringMVC中,前台jsp封装参数,绑定参数,传递参数到后台controller的过程详解
前台到后台的流程:前台jsp->后台:controller控制器层->service业务层->DAO数据访问层->数据库model模型层. 从上面流程可知,前台jsp的数据,想 ...
- springmvc中Controller方法的返回值
1.1 返回ModelAndView controller方法中定义ModelAndView对象并返回,对象中可添加model数据.指定view. 1.2 返回void 在controller方法形参 ...
- springmvc中controller内方法跳转forward?redirect?
使用springmvc的controller的时候,碰到controller内方法的跳转的问题,记录下问题以及自己测试的过程. 场景: 业务执行更新操作之后返回列表页面,列表页面需默认展示查询的列表数 ...
随机推荐
- div标签上下滚动
<div id="myInfo" style={{width:'100%',height:'100%', overflow:'scroll'}}></div> ...
- 自己家里搭建NAS服务器有什么好方案?
转自:https://www.zhihu.com/question/21359049 作者:陈二发链接:https://www.zhihu.com/question/21359049/answer/6 ...
- Selenium2入门(二)WebDriver
前文Selenium2入门(一)说到Selenium是Web 应用程序测试框架,那么如果对一个简单的web应用需求:打开浏览器,登录百度首页,输入“欧洲杯”关键词,点击搜索按钮 这一系列操作,能否用S ...
- CodeIgniter 开发,支付宝接口调用实例
准备:1.alipay官方下载最新接口类库2.解压后,将目录"\即时到账交易接口-create_direct_pay_by_user\demo\create_direct_pay_by_us ...
- AngularJS---自定义指令
AngularJS提供了一系列的内置指令,如ng开头的指令,同时AngularJS也允许用户自定义指令. 目录: 1.自定义指令 2.使用自定义指令 3.自定义指令的内嵌使用 自定义指令 Angula ...
- 学习SQL的点点滴滴(四)-UPDATE小计
1.更新tb_card中c_customer字段的值等于tb_customer表中c_no的值 update tb_card set c_customer=ct.c_no from tb_custom ...
- Socket Server-基于NIO的TCP服务器
NIO主要原理及使用 NIO采取通道(Channel)和缓冲区(Buffer)来传输和保存数据,它是非阻塞式的I/O,即在等待连接.读写数据(这些都是在一线程以客户端的程序中会阻塞线程的操作)的时候, ...
- 键盘键与虚拟键码对照表+delphi虚拟键码对应关键
键盘键与虚拟键码对照表 字母和数字键 数字小键盘的键 功能键 其它键 键 键码 键 键码 键 键码 键 键码 A 65 0 96 F1 112 Backspace 8 B 66 1 97 F2 113 ...
- MySQL绿色版的安装(mysql-5.6.22-win32.zip)
1.数据库下载 Mysql官方网站:http://www.mysql.com/,数据库下载地址:http://www.mysql.com/downloads/.从官方网站可以找到两种文件包,一种是ex ...
- DataGridView 导出到Excel
#region 导出四个表格到Excel /// <summary> /// 导出四个表格到Excel /// </summary> /// <param name=&q ...