Struts2中Action接收参数的方法
来源:互联网 发布:旋转矩阵 左手系右手系 编辑:程序博客网 时间:2024/05/14 09:46
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();
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
原文链接:http://blog.csdn.net/strawhat2416/article/details/8935415
0 0
- 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接收参数的方法
- 设计模式
- document.body.scrollTop||document.documentElement.scrollTop的意思
- fprintf()保存的数字是以字符串形式的?
- Java Sax解析xml
- Core Text 入门
- Struts2中Action接收参数的方法
- cocos2d-x下实现摇杆
- a=c++,b++;这一句是啥意思?
- Android开发之图像渲染(Shader)
- Linux 下tarball 安装软件总结
- 单例模式
- 将maven web项目部署到eclipse tomcat中
- 开元研究:产品入市调查方案——了解需求及市场环境
- chapter 12:类