UserModAction.java~25~
资源名称: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 UserModAction extends Action {
- public ActionForward execute(ActionMapping mapping, ActionForm form,
- HttpServletRequest request,
- HttpServletResponse response) {
- try{
- request.setCharacterEncoding("GBK");
- DBConn dbc = new DBConn();
- Tool tl = new Tool();
- String unmd5 = request.getParameter("username");
- if(unmd5==null){
- request.setAttribute("msg", "请选择用户!");
- return mapping.findForward("err");
- }
- String un = request.getParameter("un");
- String xm = request.getParameter("xm");
- String sex = request.getParameter("sex");
- String tel = request.getParameter("tel");
- String tel2 = request.getParameter("tel2");
- String email = request.getParameter("email");
- String sql = "update [user] set xingming = '"+xm+"',sex = '"+sex+"',tel = '"
- +tel+"',tel2 = '"+tel2+"',email = '"+email+"' where unmd5='"+unmd5+"' ";
- int i = dbc.executeUpdate(sql);
- if(i!=0){
- request.setAttribute("msg", "用户 " + un + " 修改成功!");
- return mapping.findForward("succ");
- }else{
- request.setAttribute("msg", "用户 " + un + " 修改出错,请重试!");
- return mapping.findForward("err");
- }
- }catch(Exception ex){
- ex.printStackTrace();
- request.setAttribute("msg","用户修改出现异常,请重试!");
- }
- return mapping.findForward("err");
- }
- }