DeparAddAction.java~12~
资源名称:bangong.rar [点击查看]
上传用户:dlqqsh
上传日期:2021-11-13
资源大小:7840k
文件大小:2k
源码类别:
OA系统
开发平台:
Java
- package officeol.mc.actions;
- import org.apache.struts.action.ActionMapping;
- import org.apache.struts.action.ActionForm;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import org.apache.struts.action.ActionForward;
- import org.apache.struts.action.Action;
- import officeol.mc.tools.*;
- public class DeparAddAction extends Action {
- public ActionForward execute(ActionMapping mapping, ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) {
- try{
- request.setCharacterEncoding("GBK");
- Tool tl = new Tool();
- DBConn dbc = new DBConn();
- String dn = request.getParameter("dpname");
- String dsm = request.getParameter("dpsm");
- String dnmd5 = tl.hash(dn);
- String dnsql = "select count(*) from deparment where deparname ='"+dn+"' ";
- String[][] dncheck = dbc.getArray(dnsql);
- if(!dncheck[0][0].equals("0")){
- String dsql =
- "insert into deparment (deparname,shuoming,dnmd5) values('" +
- dn + "','" + dsm + "','" + dnmd5 + "')";
- dbc.executeUpdate(dsql);
- request.setAttribute("msg", "添加用户部门 " + dn + " 成功!");
- return mapping.findForward("succ");
- }
- }catch(Exception ex){
- ex.printStackTrace();
- }
- return mapping.findForward("err");
- }
- }