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

📄 workinfoservlet.java

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

import java.io.IOException;

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.*;

public class WorkInfoServlet extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public WorkInfoServlet() {
		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");
		//获得用户填写的工作信息
		String startTime = request.getParameter("start");	//进入公司时间
		String position = request.getParameter("position");//职务	
		String department = request.getParameter("department");	//部门
		String rank = request.getParameter("trade");	//级别
		String workDescribe = request.getParameter("work");	//工作描述
		String achievement = request.getParameter("outstanding");	//主要业绩
		
		if(startTime.equals("")){
			JOptionPane.showMessageDialog(null, "必填项不能为空");
			response.sendRedirect("../emp/workInfoEdit.jsp");
		}
		
		
		else{
			//创建Vo对象
			WorkInfoVo workvo = new WorkInfoVo();	
			
			
//			PositionVo positionvo = new PositionVo();
//			positionvo.setId(position);	
//			workvo.setMyPosition(positionvo);
//			
//			
//			DepartmentVo depVo = new DepartmentVo();
//			System.out.println(department);
//			depVo.setId(department);
		
			
			HttpSession session1 = request.getSession();
			EmpVo empVo =(EmpVo) session1.getAttribute("empVo");
			workvo.setId(empVo.getId());
			
			
			workvo.setStartTime(startTime);
			workvo.setRank(rank);
			workvo.setWorkDescribe(workDescribe);
			workvo.setAchievement(achievement);
			workvo.setDepartment(department);
			workvo.setPosition(position);
			HttpSession session = request.getSession();
			session.setAttribute("workvo",workvo);
			request.getSession().setAttribute("edit", request.getSession().getAttribute("edit"));
			response.sendRedirect("../emp/familyInfoEdit.jsp");
	
			System.out.println("员工ID:"+workvo.getId()+"   进入工公司的时间:"+startTime+"职务:"+workvo.getPosition()+"部门:"+workvo.getDepartment()+"级别:"+rank+"工作描述:"+workDescribe+"主要业绩:"+achievement);
		}
	}
}

⌨️ 快捷键说明

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