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

📄 perservlet.java

📁 “JSP数据库项目案例导航”一书从第一章到第十一章各章实例的源程序文件以及数据库文件。 注意: 1. 本书中的案例提供的数据库环境不同
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package oa.servlet;

import java.io.*;
import java.text.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import oa.bean.*;
import oa.main.*;


public class PerServlet extends HttpServlet
{
	public void doGet(HttpServletRequest request ,HttpServletResponse response)throws IOException, ServletException
	{
		SmsBean smsbean = null;
		TxunBean tbean = null;			
		PersonGroupBean pGroupBean =null;
		dailyArragement dabean = null;
		try{
			DealString ds = new DealString();
			tbean = new TxunBean();
			pGroupBean =new PersonGroupBean();//建立个人群组Bean
			dabean = new dailyArragement();//日程安排Bean

			if( tbean.getConn() == null
				|| pGroupBean.getConn() == null
				|| dabean.getConn() == null ){
				PrintWriter out = response.getWriter();
				response.setContentType("text/html; charset=GB2312");
				out.println("<html>");
				out.println(ds.toASCII("<title>数据库无响应,请后退并重试</title>"));
				out.println(ds.toASCII("数据库无法响应,请&nbsp;<a href='javascript:window.history.back(-1);'>返回</a>&nbsp;重试"));
				out.println("</html>");
				out.close();
				return;
			}

			int errcode = 0;
			//取得菜单类别1.部门表2.职务表
			String strType = ds.toString((String)request.getParameter("txt_type"));
			//增删改类型1.增2.改3.删
			String strEdit = ds.toString((String)request.getParameter("txt_edit"));

			HttpSession session = request.getSession();
			//取得职工号
			String strPersonNo = ds.toString((String)session.getAttribute("zgbh"));
			//String strPersonNo= ds.toString((String)request.getParameter("txt_personno"));
			//联系人序号
			String strOrderNo = ds.toString((String)request.getParameter("txt_lxrxh"));
			//群组序号
			String strGroupNo = ds.toString((String)request.getParameter("txt_groupno"));
			//日程序号
			String strRCXH = ds.toString((String)request.getParameter("txt_rcxh"));

//.........................................可添加其他页面操作............................................//
//新增通讯录信息
			if(strType!=null && strType.equals("1") && strEdit.equals("1"))
			{
				tbean.setPersonNo(strPersonNo);
				tbean.setOrderNo(strOrderNo);
				String lxrxh = tbean.getLXRNo();//联系人序号
				String lxrxm = ds.toGBK(request.getParameter("txt_lxrxm"));//联系人姓名
				String mobile = ds.toGBK(request.getParameter("txt_yddh"));//移动电话
				String mail = ds.toGBK(request.getParameter("txt_email"));//邮件
				String bgtel = ds.toGBK(request.getParameter("txt_bgdh"));//办公电话
				String dw = ds.toGBK(request.getParameter("txt_gzdw"));//工作单位
				String dz = ds.toGBK(request.getParameter("txt_jtdz"));//家庭地址
				Hashtable ht = new Hashtable();
				ht.put("LXRXH",lxrxh);
				ht.put("LXRXM",lxrxm);
				ht.put("YDDH",mobile);
				ht.put("EMAIL",mail);
				ht.put("BGDH",bgtel);
				ht.put("GZDW",dw);
				ht.put("JTDZ",dz);
				errcode = tbean.addPerson(ht);
				//返回到查看列表的界面
				response.sendRedirect("oa/person/person.jsp?txt_type=1&txt_personno="+strPersonNo+"&errcode="+errcode);
			}
//修改通讯录信息
			if(strType!=null && strType.equals("1") && strEdit.equals("2"))
			{
				tbean.setPersonNo(strPersonNo);
				tbean.setOrderNo(strOrderNo);
				String lxrxm = ds.toGBK(request.getParameter("txt_lxrxm"));//联系人姓名
				String mobile = ds.toGBK(request.getParameter("txt_yddh"));//移动电话
				String mail = ds.toGBK(request.getParameter("txt_email"));//邮件
				String bgtel = ds.toGBK(request.getParameter("txt_bgdh"));//办公电话
				String dw = ds.toGBK(request.getParameter("txt_gzdw"));//工作单位
		        String dz = ds.toGBK(request.getParameter("txt_jtdz"));//家庭地址
				Hashtable ht = new Hashtable();
			
				ht.put("LXRXM",lxrxm);
				ht.put("YDDH",mobile);
				ht.put("EMAIL",mail);
				ht.put("BGDH",bgtel);
				ht.put("GZDW",dw);
				ht.put("JTDZ",dz);
				errcode = tbean.modPerson(ht);
				//返回到查看列表的界面
				response.sendRedirect("oa/person/person.jsp?txt_type=1&txt_personno="+strPersonNo+"&errcode="+errcode);
			}
//删除通讯录信息
			if(strType!=null && strType.equals("1") && strEdit.equals("3"))
			{
				tbean.setPersonNo(strPersonNo);
				tbean.setOrderNo(strOrderNo);
				errcode = tbean.delPerson();
				//返回到查看列表的界面
				response.sendRedirect("oa/person/person.jsp?txt_type=1&txt_personno="+strPersonNo+"&errcode="+errcode);
			}
//删除通讯录中多条信息
			if(strType!=null && strType.equals("1") && strEdit.equals("4"))
			{
				tbean.setPersonNo(strPersonNo);
				errcode = tbean.delPerson(strOrderNo);
				//返回到查看列表的界面
				response.sendRedirect("oa/person/person.jsp?txt_type=1&txt_personno="+strPersonNo+"&errcode="+errcode);
			}
//清空通讯录记录
			if(strType!=null && strType.equals("1") && strEdit.equals("5"))
			{
				tbean.setPersonNo(strPersonNo);
				errcode = tbean.clearRecord();
				//返回到查看列表的界面
				response.sendRedirect("oa/person/person.jsp?txt_type=1&txt_personno="+strPersonNo+"&errcode="+errcode);
			}

//.........................................可添加其他页面操作............................................//
//新增日程安排信息
			if(strType!=null && strType.equals("2") && strEdit.equals("1"))
			{
				String personno = strPersonNo;
				String xh = dabean.getXH(personno);
				String bt = ds.toGBK(request.getParameter("txtBT"));
				String nr = ds.toGBK(request.getParameter("txtNR"));
				String sj = ds.toGBK(request.getParameter("arraytime"));
				String tx = ds.toGBK(request.getParameter("tx"));
				String txsj = "";
				if(tx.equals("no"))
				{
					tx = "0";
					txsj = "";
				}
				if(tx.equals("yes"))
				{
					tx = "1";
					txsj = ds.toGBK(request.getParameter("txtime"));
				}
				Hashtable ht = new Hashtable();
				ht.put("ZGBH",personno);
				ht.put("RCXH",xh);
				ht.put("BT",bt);
				ht.put("NR",nr);
				ht.put("SJ",sj);
				ht.put("TXSJ",txsj);
				ht.put("SFTX",tx);
				errcode = dabean.addRC(ht);
				//返回日程列表页面
				response.sendRedirect("oa/person/person.jsp?txt_type=2&txt_personno="+personno+"&errcode="+errcode);
			}
//修改日程安排信息
			if(strType!=null && strType.equals("2") && strEdit.equals("2"))
			{
				String personno = strPersonNo;
				String xh = strRCXH;                  
				String bt = ds.toGBK(request.getParameter("txtBT"));
				String nr = ds.toGBK(request.getParameter("txtNR"));
				String sj = ds.toGBK(request.getParameter("arraytimemod"));
				String tx = ds.toGBK(request.getParameter("txmod"));
				String txsj = "";
				if(tx.equals("no"))
				{
					tx = "0";
					txsj = "";
				}
				if(tx.equals("yes"))
				{
					tx = "1";
					txsj = ds.toGBK(request.getParameter("txtimemod"));
				}
//System.out.println("www+++++++++++++++++++++++++++++++wwww="+personno+"  rcxh="+xh);
				Hashtable ht = new Hashtable();
				ht.put("ZGBH",personno);
				ht.put("RCXH",xh);
				ht.put("BT",bt);
				ht.put("NR",nr);
				ht.put("SJ",sj);
				ht.put("TXSJ",txsj);
				ht.put("SFTX",tx);
				errcode = dabean.modRC(ht);
							//返回日程列表页面
				response.sendRedirect("oa/person/person.jsp?txt_type=2&txt_personno="+personno+"&errcode="+errcode);			
			}
//删除日程安排信息
			if(strType!=null && strType.equals("2") && strEdit.equals("3"))
			{
				String personno = strPersonNo;

⌨️ 快捷键说明

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