Package com.action.addrbook

Source Code of com.action.addrbook.CategoryInputAction

package com.action.addrbook;

import com.db.addrbook.CategoryDAO;
import com.db.addrbook.CategoryVO;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;

public class CategoryInputAction implements ModelDriven<Object>, Preparable

  private CategoryVO cvo;
  private CategoryDAO caDAO;
 
  public void setCaDAO(CategoryDAO caDAO) {
    this.caDAO = caDAO;
  }
  @Override
  public void prepare() throws Exception {
    cvo = new CategoryVO();
  }
  @Override
  public Object getModel() { 
    return cvo;
  }
 
  public String insertCategory(){
    String result = ""
    try {     
      //System.out.println(cvo.toString());
      caDAO.insertCategory(cvo);
      result = "success";
    } catch (Exception e) {
      System.out.println("CategoryInputAction.insertCategory():"+e.toString());     
      result = "error";
    }
    return result;   
  }
 
  public String updateCategory(){
    String result = "";   
    try {     
      //System.out.println(cvo.toString());
      caDAO.updateCategory(cvo);
      result = "success";
    } catch (Exception e) {
      System.out.println("CategoryInputAction.updateCategory():"+e.toString());
      result = "error";
    }
    return result;   
  }
}
TOP

Related Classes of com.action.addrbook.CategoryInputAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.