Struts2中Action接收参数的方法主要有以下三种:
来源:互联网 发布:黄金价格用什么软件 编辑:程序博客网 时间:2024/05/18 02:58
Struts2中Action接收参数的方法主要有以下三种:
1.使用Action的属性接收参数(最原始的方式):
a.定义:在Action类中定义属性,创建get和set方法;
b.接收:通过属性接收参数,如:userName;
c.发送:使用属性名传递参数,如:user1!add?userName=jim;
2.使用DomainModel接收参数:
a.定义:定义Model类,在Action中定义Model类的对象(不需要new),创建该对象的get和set方法;
b.接收:通过对象的属性接收参数,如:user.getUserName();
c.发送:使用对象的属性传递参数,如:user2!add?user.userName=mike;
3.使用ModelDriven接收参数(现在用的比较多的方式):
a.定义:Action实现ModelDriven泛型接口,定义Model类的对象(必须new),通过getModel方法返回该对象;
b.接收:通过对象的属性接收参数,如:user.getUserName();
c.发送:直接使用属性名传递参数,如:user2!add?userName=tom
1.使用Action的属性接收参数(最原始的方式):
a.定义:在Action类中定义属性,创建get和set方法;
b.接收:通过属性接收参数,如:userName;
c.发送:使用属性名传递参数,如:user1!add?userName=jim;
2.使用DomainModel接收参数:
a.定义:定义Model类,在Action中定义Model类的对象(不需要new),创建该对象的get和set方法;
b.接收:通过对象的属性接收参数,如:user.getUserName();
c.发送:使用对象的属性传递参数,如:user2!add?user.userName=mike;
3.使用ModelDriven接收参数(现在用的比较多的方式):
a.定义:Action实现ModelDriven泛型接口,定义Model类的对象(必须new),通过getModel方法返回该对象;
b.接收:通过对象的属性接收参数,如:user.getUserName();
c.发送:直接使用属性名传递参数,如:user2!add?userName=tom
- Struts2中Action接收参数的方法主要有以下三种
- Struts2中Action接收参数的方法主要有以下三种:
- Struts2中Action接收参数的方法主要有以下三种:
- Struts2中action接收参数的三种方法
- Struts2中Action接收参数的方法
- Struts2中Action接收参数的方法
- Struts2中Action接收参数的方法
- Struts2中Action接收参数的方法
- struts2中action接收参数的方法
- struts2中action接收参数的方法
- struts2中action接收参数的方法
- struts2中action接收参数的方法
- struts2中action接收参数的方法
- struts2中action接收参数的方法
- Struts2中Action接收参数的方法
- struts2中Action接收参数的方法
- struts2中action接收参数的方法
- Struts2中Action接收参数的方法
- 回溯法的思想
- 在SpringSide 3 中使用JCaptcha
- Android APN开发流程分析
- hibernate 更新后查询缓存问题。
- VS项目出现的问题:'jni.h': No such file or directory
- Struts2中Action接收参数的方法主要有以下三种:
- SQL语句的解析过程
- Android学习笔记
- Java:vs生成JNI,java调用JNI实例
- ListView 隔行重复选中的问题
- 如何进步?程序员的自学指南
- 动态规划的思想
- Python简单两步实现天气爬虫采集器
- javabean的理解