deleteaction.java

来自「eclipse java/jsp 航空管理系统」· Java 代码 · 共 52 行

JAVA
52
字号
package yinchao.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import yinchao.model.InformationModel;
import yinchao.form.InformationForm;
import zhangchunliang.model.AppMode;

public class  DeleteAction extends Action {
	public ActionForward execute(ActionMapping map, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		if(!AppMode.getAppMode()){
			System.out.println("Application is terminated...");
			return map.findForward("appInfo");
		}
		
		InformationForm informationform=(InformationForm)form;
		
        //获得表单里的信息
		String depno = request.getParameter("depno");
		String depname=request.getParameter("depname");
		String depleader = request.getParameter("depleader");
		String deptel= request.getParameter("deptel");
		String deppnum =request.getParameter("deppnum");
		String depsalary= request.getParameter("depsalary");
	
		//把获得的值SET到自定义的 FORM 中去
		informationform.setDepno(depno);
		informationform.setDepname(depname);
		informationform.setDepleader(depleader);
		informationform.setDeptel(deptel);
		informationform.setDeppnum(deppnum);
		informationform.setDepsalary(depsalary);
		
		/*事例化功能类*/
		InformationModel informationmodel = new InformationModel();
		//执行删除操作
		int b = informationmodel.ViewDelete(informationform);
		if (b==1) {
			return map.findForward("deletesuccess");
		} else if(b==2){
			/*返回信息为请选择您要操作的对象*/
            return map.findForward("stuffexit");
	}else{return map.findForward("deletefailing");}
}
	}
		

⌨️ 快捷键说明

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