📄 updatedeptaction.java
字号:
//Created by MyEclipse Struts// XSL source (default): platform:/plugin/com.genuitec.eclipse.cross.easystruts.eclipse_4.0.1/xslt/JavaClass.xslpackage com.huang.actions;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 com.huang.common.DB.DBtool;import com.huang.forms.UpdateDeptForm;public class UpdateDeptAction extends Action { public ActionForward execute( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { UpdateDeptForm updateDeptForm = (UpdateDeptForm) form; String index = (String)request.getParameter("index"); if(index.equals("first")) { String dept_id = (String)request.getParameter("dept_id"); String sql = "select dept_name from tb_dept where dept_id="+dept_id+""; String dept_name = DBtool.getOneString(sql); if(dept_name!=null) { request.setAttribute("dept_id",dept_id); request.setAttribute("dept_name",dept_name); return mapping.findForward("fail"); } } if(index.equals("update")) { String dept_id = request.getParameter("dept_id"); String dept_name = updateDeptForm.getDept_name(); String sql = "update tb_dept set dept_name = '"+dept_name+"' where dept_id = "+dept_id+""; if(DBtool.updateData(sql)) { return mapping.findForward("success"); } } return mapping.findForward("success"); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -