⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editservlet.java

📁 办公自动化系统,有人事资源管理模块,考勤管理,审批管理,权限设定等.
💻 JAVA
字号:
package com.lovo.servlet.xy;

import java.io.IOException;
import java.util.Vector;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.swing.JOptionPane;

import com.lovo.bo.xy.EmpBo;
import com.lovo.vo.xy.*;
import com.lovo.po.xy.*;
import javax.swing.*;

public class EditServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public EditServlet() {
		super();
	}

	/**
	 * Destruction of the servlet. <br>
	 */
	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		// Put your code here
	}

	/**
	 * The doGet method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to get.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doPost(request,response);
	}

	/**
	 * The doPost method of the servlet. <br>
	 *
	 * This method is called when a form has its tag value method equals to post.
	 * 
	 * @param request the request send by the client to the server
	 * @param response the response send by the server to the client
	 * @throws ServletException if an error occurred
	 * @throws IOException if an error occurred
	 */
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		
		
		//获得页面信息
		int insex;
		int Marryed;
		String id = request.getParameter("userid");
		String	name =request.getParameter("name");	//员工姓名
		String oldName = request.getParameter("pastname");	//员工曾用名
		String idCard = request.getParameter("idcard");//身份证
		String sex = request.getParameter("sex");	//性别
		if(sex.equals("女")){
			insex = 1; 
		}else{
			insex=2;
			}
		String nation = request.getParameter("nation");//	民族		
		String birthday	= request.getParameter("birthday");//出生日期
		String birthPlace = request.getParameter("homeplace");	//出生地
		System.out.println(birthPlace);
		String hometown	= request.getParameter("nativeplace");//籍贯
		String background = request.getParameter("familymeg");	//家庭出生
		String politicsFeature = request.getParameter("visage");	//政治面貌
		String degree = request.getParameter("degree");	//学历
		String isMarryed = request.getParameter("marriage");	//是否结婚
		
		if(isMarryed.equals("巳婚")){
			Marryed = 1; 
		}else{
			Marryed=2;
			}
		String gratuateSchool = request.getParameter("finishSchool");	//毕业学校
		String phone = request.getParameter("handset");	//电话号码
		String firstWorkDate = request.getParameter("workTime");	//第一次参加工作时间
		String remark = request.getParameter("remark");	//备注
		String discipline = request.getParameter("speciality");	//专业
		
		if(idCard.equals("") || name.equals("")){
			
			JOptionPane.showMessageDialog(null, "必填项不能为空");
			response.sendRedirect("../emp/basicInfoEdit.jsp");
				
		}
		
		else{
		
		
			//传给Vo
			EmpVo empvo = new EmpVo();
			empvo.setId(id);
			empvo.setName(name);
			empvo.setOldName(oldName);
			empvo.setIdCard(idCard);
			empvo.setSex(insex);
			empvo.setNation(nation);
			empvo.setBirthDay(birthday);
			empvo.setBirthPlace(birthPlace);
			empvo.setHomeTown(hometown);
			empvo.setBackGround(background);
			empvo.setPoliticsFeature(politicsFeature);
			empvo.setDegree(degree);
			empvo.setIsMarryed(Marryed);
			empvo.setGraduateSchool(gratuateSchool);
			empvo.setPhone(phone);
			empvo.setFirstWorkDate(firstWorkDate);
			empvo.setRemark(remark);
			empvo.setDiscipline(discipline);
			
			Vector<DepartmentVo> voVec = new Vector<DepartmentVo>();
			EmpBo empbo = new EmpBo();
			voVec = empbo.selectDep();
			
			Vector<PositionVo> posvo = new Vector<PositionVo>();
			EmpBo empbo1 = new EmpBo();
			posvo = empbo1.selectpos();
			
			
			HttpSession session = request.getSession();
			session.setAttribute("empVo", empvo);
			session.setAttribute("depVec", voVec);
			session.setAttribute("posVec", posvo);
			session.setAttribute("edit", session.getAttribute("edit"));
			response.sendRedirect("../emp/workInfoEdit.jsp");
		}
	}
}

⌨️ 快捷键说明

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