📄 appinfoservlet.java
字号:
package com.servlet;
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.dao.AppInfoDAO;
import com.dao.impl.AppInfoDAOImpl;
import com.entity.AppInfo;
public class AppInfoServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
public AppInfoServlet() {
super();
}
public void destroy() {
super.destroy();
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("gb2312");
response.setCharacterEncoding("gb2312");
int appSex = Integer.parseInt(request.getParameter("appSex"));
String appNation = request.getParameter("appNation");
int appPolitical = Integer.parseInt(request.getParameter("appPolitical"));
String appBirth = request.getParameter("appBirth");
String appHome = request.getParameter("appHome");
int appMarriage = Integer.parseInt(request.getParameter("appMarriage"));
int appLevel = Integer.parseInt(request.getParameter("appLevel"));
String appSchool = request.getParameter("appSchool");
int appTel = Integer.parseInt(request.getParameter("appTel"));
String appDuty = request.getParameter("appDuty");
String appFeatures = request.getParameter("appFeatures");
AppInfoDAO appInfoDAOImpl = new AppInfoDAOImpl();
// String SappIndify = (String) request.getAttribute("SappIndify");
// int appIndify = Integer.parseInt(SappIndify);
// String SappIndify = (String) request.getAttribute("SappIndify");
HttpSession session = request.getSession(false);
String SappIndify = (String) session.getAttribute("SappIndify");
int appIndify = Integer.parseInt(SappIndify);
AppInfo appInfo = appInfoDAOImpl.queryAppInfoByIndify(appIndify);
String buttonbad = request.getParameter("submit");
String button = buttonbad.substring(0, 2);
System.out.println(button);
if(button.equals("提交")){
appInfo.setAppSex(appSex);
appInfo.setAppNation(appNation);
appInfo.setAppPolitical(appPolitical);
appInfo.setAppBirth(appBirth);
appInfo.setAppHome(appHome);
appInfo.setAppMarriage(appMarriage);
appInfo.setAppLevel(appLevel);
appInfo.setAppSchool(appSchool);
appInfo.setAppTel(appTel);
appInfo.setAppDuty(appDuty);
appInfo.setAppFeatures(appFeatures);
appInfoDAOImpl.updateAppInfo(appInfo);
request.getRequestDispatcher("/servlet/PostsListServlet").forward(request, response);
}
}
public void init() throws ServletException {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -