81,092
社区成员
发帖
与我相关
我的任务
分享
public class Student {
private String name;
public String getName() {
return age;
}
public void setName(String name) {
this.name = name;
}
}
public class StudentAction extends ActionSupport {
private Student student;
public Student getStudent() {
return student;
}
public void setStudent(Student student) {
this.student = student;
}
@Override
public void validate() {
if( this.student.getName() == null
|| "".equals(this.student.getName().trim())){ //提示这行出现空指针
this.addFieldError("name", "名称不能为空");
}
}
}