接收参数

1.用Action属性接收参数
在url中写上name=aaa&age=26
在对应的Action中声明俩个成员变量name 和 age,定义两个变量的get 和 set方法。这样即可。

2.用领域模型(Domain Model)来接受参数
在url中写上user.name=aaa&user.age=26
在对应的Action中声明成员变量private User user;定义user的get 和 set方法。这样即可。

3.自定义的Action实现ModelDriven接口(实现其getModel()方法)
在url中写上name=aaa&age=26
在对应的Action中private User user = new User();

猜你喜欢

转载自sl1202.iteye.com/blog/1284408