SpingMVC ModelAttribute的用法
@Controller
@RequestMapping(value = "/test")
public class TestController {
@RequestMapping("/addUser")
public void addUser(@ModelAttribute(value = "adminUser") AdminUser adminUser, Writer writer) throws IOException {
System.out.println("adminUser = " + adminUser);
writer.write("successfully");
} @RequestMapping("/addUser2")
public void addUser2(AdminUser adminUser2, Writer writer) throws IOException {
System.out.println("adminUser2 = " + adminUser2);
writer.write("successfully2");
}
}
两种写法都能达到一样的效果。
SpingMVC ModelAttribute的用法的更多相关文章
- SpringMvc @ModelAttribute 的用法
参考:Spring 3.x 企业应用开发实战 第15章:SpringMvc 页码:532 ModelAttribute 从字面上解释就是模型的属性. 对于MVC框架来说是模型数据是最重要的,因为 ...
- @RequestMapping @SessionAttributes @ModelAttribute注解用法
简介: @RequestMapping RequestMapping是一个用来处理请求地址映射的注解,可用于类或方法上.用于类上,表示类中的所有响应请求的方法都是以该地址作为父路径. RequestM ...
- springMVC注解用法:@modelattribute的用法
在Spring MVC里,@ModelAttribute通常使用在Controller方法的参数注解中,用于解释model entity,但同时,也可以放在方法注解里. 如果把@ModelAttrib ...
- @ModelAttribute的用法
- springmvc的ModelAttribute注解
先看一个没有使用@ModelAttribute的Controller方法. @RequestMapping("/save") public String save(User use ...
- springMVC源码分析--@ModelAttribute使用及运行原理
这一篇博客我们简单的介绍一下ModelAttribute的使用和运行原理. 1.首先@ModelAttribute是使用在方法或者上的,当使用在方法上时其作用于本身所在的Controller,在访问C ...
- spring MVC注解深入研究
@Controller @Service @Controller和 @Component注册一个action 到spring 上下文中,bean 的ID 默认为类名称开头字母小写.@Reposito ...
- SpringMVC_One
SpringMVC_One SpringMVC的优势 (面试) 清晰的角色划分: 前端控制器(DispatcherServlet) 请求到处理器映射器(HandlerMapping) 处理器适配器(H ...
- spring的@ControllerAdvice注解
@ControllerAdvice注解是Spring3.2中新增的注解,学名是Controller增强器,作用是给Controller控制器添加统一的操作或处理. 对于@ControllerAdvic ...
随机推荐
- 在C#用HttpWebRequest中发送GET/HTTP/HTTPS请求【转载】
标签:C# HTTPS HttpWebRequest HTTP HttpWebResponse 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任. ...
- jquery的$(document).ready()和onload的加载顺序
最近在改一个嵌入在frame中的页面的时候,使用了jquery做效果,而页面本身也绑定了onload事件.改完后,Firefox下测试正常流畅,IE下就要等个十几秒jquery的效果才出现,黄花菜都凉 ...
- 分享:JS比较两个日期大小
发布:thatboy 来源:Net [大 中 小] 本文介绍下,在javascript代码中,比较两个日期大小的方法,有需要的朋友参考下. 转自:http://www.jbxue.com/ ...
- Python开发【第一篇】Python基础之自定义模块和内置模块
为什么要有模块,将代码归类.模块,用一砣代码实现了某个功能的代码集合. Python中叫模块,其他语言叫类库. 类似于函数式编程和面向过程编程,函数式编程则完成一个功能,其他代码用来调用即可,提供了代 ...
- XHTML1.0对HTML4.0的改进
1.XHTML借鉴了XML的写法,语法更加严格: 2.XHTML实现了把页面样式和内容分离了,废弃了HTML4.0中表示样式的标签和属性,推荐使用CSS样式来描述页面的样式. XHTML1.0 分为两 ...
- 关于一道简单的Java 基础面试题的剖析: short s1=1;s1 = s1 +1会报错吗?
package common; public class ShortTypeTest { /* * @param args */ public static void main(String[] ar ...
- SQLserver中的xp_cmdshell
shell是用户与操作系统对话的一个接口,通过shell告诉操作系统让系统执行我们的指令 xp_cmdshell在sqlserver中默认是关闭的存在安全隐患. --打开xp_cmdshell ;;R ...
- github pages
http://zyip.github.io/facemaker/index echo "hello world" >>hello.htm git init git ad ...
- JSTL标签总结
一.JSTL简介: 1.JSP标准标签库JSTL(JSP Standard Tag Library)是一个JSP标签集合,它封装了JSP应用的通用核心功能. 2.JSTL支持通用的.结构化的任务.比如 ...
- How to use Android Activity's finish(), onDestory() and System.exit(0) methods
Activity.finish() Calling this method will let the system know that the programmer wants the current ...