[JAVA] update servlet

public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request,
		HttpServletResponse response) throws Exception {

	///////////////////////////////////////////////

// [Update] button press judgment /////////////////////////////////////////////// String type = request.getParameter("submitKousin"); if (type! = null) {// Originally, it is a comparison with the "login" character string, but since it is garbled, it is a null comparison. MainForm mainForm = (MainForm)form; request.getSession().setAttribute("SESSION_LOGIN_ID", mainForm.getCustId()); return setSInfo(mapping, form, request, response); }

	///////////////////////////////////////////////

// [Clear] button press judgment /////////////////////////////////////////////// type = request.getParameter ("submitClose"); // Originally, it is a comparison with a "clear" character string, but since it is garbled, it is a NULL comparison. if (type != null) { return close(mapping, form, request, response); }

	///////////////////////////////////////////////

// [Update] button press judgment /////////////////////////////////////////////// type = request.getParameter("submit"); if (type! = null) {// Originally, it is a comparison with the "employee update" character string, but since it is garbled, it is a null comparison. return mapping.findForward(""); }

	///////////////////////////////////////////////

// [Initial processing] /////////////////////////////////////////////// return init(mapping, form, request, response);

}


private ActionForward init(ActionMapping mapping, ActionForm form, HttpServletRequest request,HttpServletResponse response) throws Exception {

	MainForm mainForm = (MainForm)form;

// Get employee ID from session String userId = (String)request.getSession().getAttribute("SESSION_LOGIN_ID");

// Get employee information from the employee information table DShainData userInfo = getUserInfo(userId);

// Set the value for the form setShainData(mainForm, userInfo);

// Set form information for session request.getSession().setAttribute("recMainGjobForm", mainForm);

// Transition destination is own screen (defined in struts-config.xml) return mapping.findForward("success"); }

/**

// Get data from DB DShainData out = mng.getShainInfo(in); return out; }

/**

// Set employee ID mainForm.setCustId(userInfo.getShainId()); // Set employee name mainForm.setName(userInfo.getShainNm()); //社員年齢を設定 String age = Integer.toString(userInfo.getAge()); mainForm.setAge(age); // Set zip code mainForm.setPostNo(userInfo.getPostNo()); // Set the prefecture number mainForm.setKenNo(userInfo.getAddressCd()); // Set address 2 mainForm.setAddress2(userInfo.getAddress2()); // Set address 3 mainForm.setAddress3(userInfo.getAddress3());

}


/**

//formにあるJSPより取得したデータをKshinseiForm型にする MainForm mainForm = (MainForm)form;

// Get employee ID from session String userId = (String)request.getSession().getAttribute("SESSION_LOGIN_ID");

//JSPより取得したデータをSQLでインサートするほうへ移す DShainData upData = new DShainData(); upData.setShainId(userId); upData.setShainNm(mainForm.getName()); int iAge = Integer.parseInt(mainForm.getAge()); upData.setAge(iAge); upData.setPostNo(mainForm.getPostNo()); upData.setAddressCd(mainForm.getKenNo()); upData.setAddress2(mainForm.getAddress2()); upData.setAddress3(mainForm.getAddress3()); //upData.setDelKbn("0"); //upData.setEntryId("111003"); //upData.setUpdateId("111003");

// Data INSERT class MShainInfo info = new MShainInfo();

// Send data to UPDATE class as list data info.upDateSInfo(upData);

// Transition destination is own screen (defined in struts-config.xml) return mapping.findForward("kosin");

}

Recommended Posts

update servlet
Servlet
insert servlet
Servlet movement
[Java] Servlet filter
CentOS rbenv update
[Servlet] Basic method