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

📄 registerservlet.java

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

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;

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 com.lovo.bo.zhaobing.AwardInfoBo;

import com.lovo.po.PositionPo;
import com.lovo.vo.zhaobing.DepartmentVo;
import com.lovo.vo.zhaobing.EmpVo;

public class RegisterServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public RegisterServlet() {
		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");
		HttpSession session = request.getSession();
		//获得页面信息
		int insex;
		int Marryed;
		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");	//出生地
		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");	//专业
		//传给Vo
		EmpVo empvo = new EmpVo();
		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);
		
		
		AwardInfoBo abo = new AwardInfoBo();
		EmpVo empvoo =abo.EmpBo(empvo);
		session.setAttribute("empVo", empvoo);
		ArrayList<DepartmentVo> alist =  abo.department();
		session.setAttribute("alist", alist);
		ArrayList<PositionPo> plist =  abo.position();
		session.setAttribute("plist", plist);
		
		response.sendRedirect("../emp/employeeRegisterWork.jsp");
	}
}

⌨️ 快捷键说明

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