employeeform.java

来自「是jsp开发与应用详解的全部源代码」· Java 代码 · 共 45 行

JAVA
45
字号
package com.jspdev.ch18;import javax.servlet.http.HttpServletRequest;import org.apache.struts.action.*;import javax.servlet.http.HttpServletRequest; public class EmployeeForm extends ActionForm  {    private Employee employee=new Employee();      //private String name;  public void setName(String name)  {  	this.employee.setName(name);  }  public String getName()  {  	return this.employee.getName();  }   public void setEmployee(Employee employee)   {   	   this.employee=employee;   }   public Employee getEmployee()   {   	   return this.employee;   }        public void reset(ActionMapping mapping, HttpServletRequest request) {        this.employee=new Employee();    }        public ActionErrors validate(ActionMapping mapping,                    HttpServletRequest request)     {        ActionErrors errors = new ActionErrors();        if ((employee.getName() == null) || (employee.getSalary()<0))        {             errors.add("name", new ActionError("name is null"));        }        return errors;     }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?