struts2学习笔记九——使用ModelDriven接收参数
使用ModelDriven接收参数
userAction.javapackage com.zby.struts2.user.action;import com.opensymphony.xwork2.ActionSupport;import com.opensymphony.xwork2.ModelDriven;import com.zby.struts2.user.Model.User;public class UserAction extends ActionSupport implements ModelDriven<User>{private User user=new User();public String add(){System.out.println("name="+user.getName());System.out.println("age="+user.getAge());return SUCCESS;}public User getModel() {return user;}}
index.jsp<a href="user/user!add?name=a&age=8">