📄 tocompeditxg2action.java
字号:
package com.isoftstone.banktearm1.to;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.isoftstone.banktearm1.dao.ToCompEditSelectDao;
public class ToCompEditXg2Action extends HttpServlet {
/**
* 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
*/
ToCompEditSelectDao dao=new ToCompEditSelectDao();
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String code=(String)request.getAttribute("code");
if(code.equals("4")){
//修改页面的关闭
request.getRequestDispatcher("ToCompEdit").forward(request, response);
return ;
}
try{
int Number1=1;
String Number=request.getParameter("Number");
if(!Number.equals("")){
Number1=Integer.parseInt(Number);
}
String computertype=(String)request.getAttribute("computertype");
String cpu=(String)request.getAttribute("cpu");
String memory=(String)request.getAttribute("memory");
String harddisk=(String)request.getAttribute("harddisk");
String os=(String)request.getAttribute("os");
String ipaddress=(String)request.getAttribute("ipaddress");
String macaddress=(String)request.getAttribute("macaddress");
String username=(String)request.getAttribute("username");
String houseid=(String)request.getAttribute("houseid");
String dutypeople=(String)request.getAttribute("dutypeople");
String use=(String)request.getAttribute("use");
String buytime=(String)request.getAttribute("buytime");
String usetime=(String)request.getAttribute("usetime");
String whichuse=(String)request.getAttribute("whichuse");
String sql="update comp set ComputerType='"+computertype+"',CPU='"+cpu+"',Memory='"+memory+"',Harddisk='"+harddisk+"',OS='"+os+"',IPAddress='"+ipaddress+"',MACAddress='"+macaddress+"',UserName='"+username+"',HouseID='"+houseid+"',DutyPeople='"+dutypeople+"'," +
" Use='"+use+"',UseTime='"+usetime+"',WhichUse='"+whichuse+"' where NumberID="+Number1;
//System.out.println(sql);
dao.getUpdate(sql);
if(code.equals("5")){
//修改
request.getRequestDispatcher("ToCompEdit").forward(request, response);
}
}
catch (Exception e) {
request.setAttribute("errorMessage", e.getMessage());
request.getRequestDispatcher("BankTeam1ErrorPage.jsp").forward(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 {
this.doGet(request, response);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -