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

📄 allcard.java

📁 实现办公自动化系统
💻 JAVA
字号:
package com.oa.struts.perOffice.modle;

import java.util.List;
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.oa.struts.vo.AllCardInfo;
import com.oa.struts.vo.LoginInfo;
import com.oa.util.Chinese_Do;
import com.oa.util.GetNames;

public class AllCard extends HttpServlet {

	
	public AllCard() {
		super();
	}

	public void destroy() {
		super.destroy(); // Just puts "destroy" string in log
		
	}

	/**
	 * 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 {
		LoginInfo loginInfo=new LoginInfo();
		GetNames getName=new GetNames();
		System.out.print("获取数据");
		Chinese_Do cd=new Chinese_Do();
		String deptID=cd.getString(request.getParameter("DeptName"));
		String userName=cd.getString(request.getParameter("userName"));
		if(deptID==null || deptID.equals(""))
		{
			deptID="-1";
			System.out.println("deptId=null");
		}
		if(userName==null){userName="";}
		AllCardInfo card=new AllCardInfo();
		
		AllCardDAO dao=new AllCardDAO();
	    List lt=dao.displayAllCard(Integer.parseInt(deptID),userName);
	    if(lt!=null)
	    {
	    	
	    	request.setAttribute("abList", lt);
	    	request.getRequestDispatcher("personalOffice/allCard.jsp").forward(request,response);
	    }
	    else
	    {
	    	System.out.println("查询失败!");
	    }
	    String methCode=request.getParameter("methCode");
	    if(methCode==null){methCode="";}
	    System.out.println("methCode="+methCode);
	    if(methCode.equals("insert"))
	    {
	    	 int usersex=Integer.parseInt(request.getParameter("userSex"));
	    	 String cardname=cd.getString(request.getParameter("cardName"));
	    	 int cardfileid=Integer.parseInt(request.getParameter("cardFileId"));
	    	 int userid=loginInfo.getUserId();
	    	 String contacttel=request.getParameter("contactTel");
	    	 int isshare=Integer.parseInt(request.getParameter("isshare"));
	    	 int deptId=Integer.parseInt(request.getParameter("receiveDept"));
	    	 String deptname=getName.getDeptName(deptId);
	    	 String address=request.getParameter("address");
	    	 String email=request.getParameter("email");
	    	 
	    	 AllCardInfo allCardInfo=new AllCardInfo();
	    	 allCardInfo.setAddress(address);
	    	 allCardInfo.setCardfileid(cardfileid);
	    	 allCardInfo.setCardname(cardname);
	    	 allCardInfo.setContacttel(contacttel);
	    	 allCardInfo.setDeptname(deptname);
	    	 allCardInfo.setEmail(email);
	    	 allCardInfo.setIsshare(isshare);
	    	 allCardInfo.setUsersex(usersex);
	    	 allCardInfo.setUserid(userid);
	    	 
	    	 AllCardDAO allCardDAO=new AllCardDAO();
	    	 boolean flag=allCardDAO.insertAllcard(allCardInfo);
	    	 if(flag)
	    	 {
	    		 request.getRequestDispatcher("/personalOffice/allCard.jsp").forward(request, response);
	    	 }
	    }
	
	}
	public void init() throws ServletException {
		// Put your code here
	}

}

⌨️ 快捷键说明

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