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

📄 processcmpadd.java

📁 实现银行系统中某个部门的计算机设备管理、公共信息管理、权限用户管理、系统设置等,为系统的安全正常运行提供保障
💻 JAVA
字号:
package com.isoftstone.banktearm1.to;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.isoftstone.banktearm1.dao.CmpAddDao;
import com.isoftstone.banktearm1.vo.BankTeam1CompVo2;

public class ProcessCmpAdd 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
	 */
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.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 {
		String code=(String)request.getAttribute("code");
		
		if(code.equals("3")){
			//添加
			try{
				String depid=(String)request.getAttribute("depid");
				CmpAddDao dao=new CmpAddDao();
				int cmpNumber=dao.getNextCmpNumber(depid);
				int id=dao.FindMaxId();
				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");
				BankTeam1CompVo2 vo=new BankTeam1CompVo2();
				vo.setId(id);
				vo.setNumberId(cmpNumber);
				vo.setComputerType(computertype);
				vo.setCpu(cpu);
				vo.setMemory(memory);
				vo.setHarddisk(harddisk);
				vo.setOs(os);
				vo.setIpAddress(ipaddress);
				vo.setMacAddress(macaddress);
				vo.setUserName(username);
				vo.setHouseId(houseid);
				vo.setDutyPeople(dutypeople);
				vo.setUse(use);
				vo.setBuyTime(buytime);
				vo.setUseTime(usetime);
				vo.setWhichUse(whichuse);
				dao.addCmp(vo);
				response.sendRedirect("ToCompAdd");
			}catch(Exception e){
				request.setAttribute("errorMessage",e.getMessage());
				request.getRequestDispatcher("BankTeam1ErrorPage.jsp").forward(request,response);
			}
		}
		else if(code.equals("4")){
			//返回
			response.sendRedirect("ToCompEdit");
		}
	}

}

⌨️ 快捷键说明

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