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内方法的跳转的问题,记录下问题以及自己测试的过程. 场景: 业务执行更新操作之后返回列表页面,列表页面需默认展示查询的列表数 ...
随机推荐
- Qt多重继承时的信号与槽
最近在公司项目中开发串口,因为历史原因串口要包装一下,且包装类需要继承自一个纯C++类. QSerialPort可以使用slot function来获取从串口读到的数据,以及写入串口的bytes个数. ...
- 如何解决Oracle RAC 安装集群软件或数据库时无法自动识别节点
在节点一 grid用户下: $ORACLE_HOME=/u01/app/11.2.0/grid/ [grid@orarac1 /]$ cd /u01/app/11.2.0/grid/oui/bin [ ...
- 在Ubuntu上安装LAMP服务器
1.安装Ubuntu上安装LAMP apt-get install lamp-server^ 2.安装过程中设置MySql密码 3.测试 创建index.php var/www/html/index. ...
- LSOF 安装与使用
linux上安装: tar zxvf lsof_4.76.tar.gz cd lsof_4.76 ls 00.README.FIRST_4.76 lsof_4.76_src.tar.gz README ...
- java 事件监听 - 键盘
java 事件监听 - 键盘 //事件监听 //键盘事件监听,写了一个小案例,按上下左右,改变圆形的位置,圆形可以移动 import java.awt.*; import javax.swing.*; ...
- 安装完CentOS 7 后必做的七件事
CentOS是最多人用来运行服务器的 Linux 版本,最新版本是 CentOS 7.当你兴趣勃勃地在一台主机或 VPS 上安装 CentOS 7 后,首要的工作肯定是加强它的安全性,以下列出的七件事 ...
- 标签中id和name的作用和区别
id:作为标签的唯一标识.name:作为可与服务器交互数据的HTML元素的服务器端的标示.
- eclipse中 报出The type javax.servlet.http.HttpServlet cannot be resolved. It is indirect错误
在Myeclispe部署项目后 报错 The type javax.servlet.http.HttpServlet cannot be resolved. It is indirect错误 如果在M ...
- "\r\n","\r","\n"
参考: http://blog.csdn.net/xiaofei2010/article/details/8458605 '\r' : 回车符 '\n' : 换行符 以下是c++语言的测试代码, 跟平 ...
- ADXL3xx: 读取 ADXL3xx 加速度传感器
原文链接:https://www.arduino.cc/en/Tutorial/ADXL3xx ADXL3xx加速度传感器 本教程将为你展示如何读取Analog Devices的ADXL3xx系列加速 ...