当前位置: 代码迷 >> Java Web开发 >> 精通Structs中addressbook:删除功能的如何实现
  详细解决方案

精通Structs中addressbook:删除功能的如何实现

热度:48   发布时间:2016-04-17 16:44:29.0
精通Structs中addressbook:删除功能的怎么实现?
前提xml中各组件已连上了,个常量也对应好了下面的代码可是不能删除啊???
1.
package   addressbook.forms;

import   javax.servlet.http.HttpServletRequest;
import   org.apache.struts.action.ActionMessage;
import   org.apache.struts.action.ActionErrors;
import   org.apache.struts.action.ActionForm;
import   org.apache.struts.action.ActionMapping;

public   final   class   DelForm   extends   ActionForm   {

        private   String   name   =   null;
        private   String   phone   =   null;
        private   String   address   =   null;
        private   String   hunk   =   null;
        private   String   delId   =   null;


        public   String   getName()   {
          return   name;
        }
      public   void   setName(String   name)   {
          this.name   =   name;
        }

      public   String   getPhone()   {
          return   phone;
        }
      public   void   setPhone(String   phone)   {
          this.phone   =   phone;
        }

      public   String   getAddress()   {
          return   address;
        }
      public   void   setAddress(String   address)   {
          this.address   =   address;
        }
      public   String   getHunk()   {
      return   address;
    }
  public   void   setHunk(String   hunk)   {
      this.hunk   =   hunk;
    }

     
public   String   getDelId()   {
return   delId;
}


public   void   reset(ActionMapping   mapping,   HttpServletRequest   request)   {

      //name   =   null;
      //phone   =   null;
      //address   =   null;
}
public   void   setDelId(String   delId)   {
this.delId   =   delId;
}

public   ActionErrors   validate(ActionMapping   mapping,
                                                        HttpServletRequest   request)   {

                ActionErrors   errors   =   new   ActionErrors();
                if   (((delId   ==   null)))
                        errors.add( "name ",   new   ActionMessage( "error.name.required "));
              //   if(((phone   ==   null)||   (phone.length()   <   1)))