📄 addemployeetodeptaction.java
字号:
package com.jspdev.ch18;
import org.apache.struts.action.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public final class AddEmployeeToDeptAction extends Action {
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
EmployeeBean service = new EmployeeBean();
DynaActionForm f=(DynaActionForm)form;
String employId=(String)f.get("employId");
String deptId=(String)f.get("deptId");
//String employId=request.getParameter("employId");
//String deptId=request.getParameter("deptId");
try {
service.resetEmploy(employId,deptId);
request.setAttribute("deptId",deptId);
return (mapping.findForward("success"));
}
catch( Exception de ) {
ActionErrors errors = new ActionErrors();
ActionError error = new ActionError("error.employee.databaseException");
errors.add( ActionErrors.GLOBAL_ERROR, error );
saveErrors( request, errors );
return (mapping.findForward("error"));
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -