SpringMVC Model,ModelMap ModelAndView
SpringMVC 调用方法之前会创一个隐含的模型对象(即Model,ModelMap ModelAndView)
//@ModelAttribute 先于login方法执行
@ModelAttribute
public void userModel(String username,String password,Model model){
User user = new User();
user.setUserName(username);
model.addAttribute("user", user );
}
@RequestMapping("/login")
public String login(Model model){
User user = (User) model.asMap().get("user");
System.out.println(user.getUserName());
return "successPage";
}
SpringMVC Model,ModelMap ModelAndView的更多相关文章
- Spring中Model,ModelMap和ModelAndView
目录 1.Model接口 2.ModelMap 3.ModelAndView 1.Model接口(org.springframework.ui.Model) Model是一个接口,包含addAttri ...
- SpringMVC ModelAndView、Map、Model、ModelMap
目标方法返回值可以是ModelAndView .Map.Model.ModelMap类型,但最根本还都是ModelAndView. 其中可以包含试图和模型信息. SpringMVC 会把ModelAn ...
- springMVC Model ModelMap 和 ModelAndView的区别(转)
原文地址:springMVC Model ModelMap 和 ModelAndView的区别 近来在看代码,发现controller里有不同的处理返回数据的方式,而自己一直在用ModelAndVie ...
- SpringMVC中Map、Model、ModelMap、ModelAndView之间的关系及区别
首先,在了解这三者之前,需要知道一点:SpringMVC在调用方法前会创建一个隐含的数据模型(Model),作为模型数据的存储容器, 成为”隐含模型”. 如果controller方法的参数为Moedl ...
- springMVC:modelandview,model,controller,参数传递
转载:http://blog.csdn.net/wm5920/article/details/8173480 1.web.xml 配置: copy <> ></> & ...
- springboot中model,modelandview,modelmap的区别与联系
springboot 中Model,ModelAndView,ModelMap的区别与联系 Model是一个接口,它的实现类为ExtendedModelMap,继承ModelMap类 public c ...
- Spring中Model、ModelMap及ModelAndView之间的区别
Spring中Model.ModelMap及ModelAndView之间的区别 1. Model(org.springframework.ui.Model)Model是一个接口,包含addAttr ...
- Spring中Model、ModelMap及ModelAndView之间的区别+传递参数
org.springframework.ui.Model(接口)传递数据,Spring框架自动创建它的一个实现类,如BindingAwareModelMap org.springframework.u ...
- Model、ModelMap、ModelAndView的使用和区别
1.Model的使用 数据传递:Model是通过addAttribute方法向页面传递数据的: 数据获取:JSP页面可以通过el表达式或C标签库的方法获取数据: return:return返回的是指定 ...
随机推荐
- Meteor Blaze
Blaze是Meteor 软件包用于构建现场反应模板. Render方法 这种方法被用于绘制模板到DOM.首先,我们将创建 myNewTemplate 之后渲染. 我们增加 myContainer 这 ...
- Python访问MySQL数据库并实现其增删改查功能
概述:对于访问MySQL数据库的操作,我想大家也都有一些了解.不过,因为最近在学习Python,以下就用Python来实现它.其中包括创建数据库和数据表.插入记录.删除记录.修改记录数据.查询数据.删 ...
- curl 发送json请求
curl 发送json请求 这个是在cmd环境下的输入:注意{\"userName\":\"helo\",\"id\":1}中间不能有空格 ...
- vue 自定义报警组件
1.自定义报警组件 Alarm.vue <!-- 报警 组件 --> <template> <div class="alarm"> <!- ...
- Mac Chrome-点击书签页在新的标签打开之方法
PS:一直使用的是Firefox,但是现在Firefox有些不能满足我现在的需求,所以下载了chrome.可是当使用chrome时发现有一个很实用的功能它不能设置,这个让我很抓狂. 当点击标签时不能新 ...
- a simple and universal interface between web servers and web applications or frameworks: the Python Web Server Gateway Interface (WSGI).
WSGI is the Web Server Gateway Interface. It is a specification that describes how a web server comm ...
- Android应用基础学习记录
01_前言 前言,了解了Android的情况.这里也介绍一下本文.本文是记录学习Android应用程序开发过程,视频中使用的Android2.2版本号,我以4.2版本号为基础,找出当中的差异并记录下来 ...
- 2.7 xargs和exec详解【转】
本文转载自:http://ask.apelearn.com/question/13323 常用在查找中exec主要是和find一起配合使用,而xargs就要比exec用的地方要多了. exec 应用 ...
- Cmake的介绍和使用 Cmake实践【转】
本文转载自:http://www.cppblog.com/Roger/archive/2011/11/17/160368.html Cmake的介绍和使用 Cmake实践 Cmake优点: 1. ...
- bzoj3272: Zgg吃东西&&3267: KC采花
口胡 我们容易得到一个费用流的做法,流出k的流量分配给各个点,各个点向下一个点流费用为它的价值的边,然后汇总到ed 观察发现对于流一次,相当于选择了一个区间 如果流了反向边,相当于减去了这一段 可以用 ...