Struts2----ModelDriven

xiaoxiao2021-03-01  43

 

Action类

 

package com.pegasus.web; import com.opensymphony.xwork2.ActionSupport; import com.opensymphony.xwork2.ModelDriven; import com.pegasus.domain.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; } /** 实现这个方法,获得封装好的实例 */ @Override public User getModel() { return user; } }  

 

相关资源:Office2016专业增强版中文免费正式版(附安装教程)64位
转载请注明原文地址: https://www.6miu.com/read-4150182.html

最新回复(0)