📄 familyservlet.java
字号:
package com.lovo.servlet.zhaobing;
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 com.lovo.bo.zhaobing.AwardInfoBo;
import com.lovo.vo.zhaobing.EmpVo;
import com.lovo.vo.zhaobing.FamilyInfoVo;
public class FamilyServlet extends HttpServlet {
/**
* Constructor of the object.
*/
public FamilyServlet() {
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();
//获得用户登陆信息
EmpVo empv = (EmpVo)session.getAttribute("empVo");
//家庭信息
String momName = request.getParameter("mname"); //母亲姓名
String dadName = request.getParameter("fname"); //父亲姓名
String mateName = request.getParameter("othername"); //配偶姓名
String momVocation =request.getParameter("mjob"); //母亲职业
String dadVocation = request.getParameter("fjob"); //父亲职业
String mateVocation = request.getParameter("otherjob"); //配偶职业
String childName = request.getParameter("childname"); //孩子姓名
String childDegree = request.getParameter("childDegree"); //孩子学历
String postcode = request.getParameter("postcode");//邮政编码
String familyPhone = request.getParameter("phone");//家庭电话号码
String position = request.getParameter("add");
//创建Vo
FamilyInfoVo familyvo = new FamilyInfoVo();
familyvo.setMName(momName);
familyvo.setFName(dadName);
familyvo.setOtherName(mateName);
familyvo.setMVocation(momVocation);
familyvo.setFVocation(dadVocation);
familyvo.setOtherVocation(mateVocation);
familyvo.setChildName(childName);
familyvo.setPostcode(postcode);
familyvo.setPhone(familyPhone);
familyvo.setChildDegree(childDegree);
familyvo.setPosition(position);
familyvo.setMyEmpPo(empv);
AwardInfoBo ado = new AwardInfoBo();
ado.FamilyInfoBo(familyvo);
session.setAttribute("familyVo", familyvo);
response.sendRedirect("../emp/employeeRegisterWard.jsp");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -