基于javaweb+mysql的jsp+servlet慢病报销管理信息系统(java+mysql+jdbc+servlet+jsp)

基于javaweb+mysql的jsp+servlet慢病报销管理信息系统(java+mysql+jdbc+servlet+jsp)

运行环境

Java≥8、MySQL≥5.7、Tomcat≥8

开发工具

eclipse/idea/myeclipse/sts等均可配置运行

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

功能说明

基于javaweb+mysql的JSP+Servlet慢病报销管理信息系统(java+mysql+jdbc+servlet+jsp)

一、项目简述 功能: 慢病管理,医疗机构管理,家庭管理,费用交纳,费用报销,报表统计等等功能。

二、项目运行

环境配置:

Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:

Jdbc+ Servlert + Jsp + css + JavaScript + JQuery + Ajax + Fileupload等等


		// 获取当前年份
		Calendar instance = Calendar.getInstance();
		int i = instance.get(Calendar.YEAR);

		// 系统检查是否设置当年缴费标准。
		PolicyDao policyDao = new PolicyDao();
		Policy queryByYears = policyDao.queryByYears(i);
		boolean hasyear;
		boolean isovertime;
		if (queryByYears != null) {
			hasyear = true;
		} else {
			hasyear = false;
		}
		map.put("hasyear", hasyear);
		// 系统检查当前系统时间是否在参合缴费时间起始时间段内。
//		int j = instance.get(Calendar.DAY_OF_YEAR);
//		if (j > 180) {
//			isovertime = true;
//		} else {
			isovertime = false;
//		}
		map.put("isovertime", isovertime);
		// 获取用户所在乡镇

		// 系统弹出对话框显示本乡镇下所有同名户主。
		FamilyDao f = new FamilyDao();
		List<Family> queryAllbyName = f.queryAllbyName(householder);
		map.put("info", queryAllbyName);
		System.out.println(new Gson().toJson(map));
		resp.getWriter().println(new Gson().toJson(map));
	}

	/**
	 * 显示户主所在家庭所有未完全缴费的参合人员
	 * 
	 * @param req
	 * @param resp
	 * @throws ServletException
	 * @throws IOException
	 */
	public void selPerson(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String familycode = req.getParameter("familycode");
		// 获取当前年
		Calendar calendar = Calendar.getInstance();
		int i = calendar.get(Calendar.YEAR);
		String countycode = req.getParameter("countycode");
		String towncode = req.getParameter("towncode");
		String villagecode = req.getParameter("villagecode");
		String groupcode = req.getParameter("groupcode");
		String details = req.getParameter("details");
		AreaDao ad = new AreaDao();

		if (groupcode == null && details == null) {
			address = ad.queryAreaByCode(countycode).getAreaname() + ad.queryAreaByCode(towncode).getAreaname()
					+ ad.queryAreaByCode(villagecode).getAreaname();
		} else if (details == null) {
			address = ad.queryAreaByCode(countycode).getAreaname() + ad.queryAreaByCode(towncode).getAreaname()
					+ ad.queryAreaByCode(villagecode).getAreaname() + ad.queryAreaByCode(groupcode).getAreaname();
		} else {
			address = ad.queryAreaByCode(countycode).getAreaname() + ad.queryAreaByCode(towncode).getAreaname()
					+ ad.queryAreaByCode(villagecode).getAreaname() + ad.queryAreaByCode(groupcode).getAreaname()
					+ details;
		}

		// address=countycode+towncode+villagecode+groupcode+details;

		Person person = new Person(null, name, relation, idnumber, sex, ishealthy, nation, culture, age, brithday,
				perattr, isvillage, vocation, company, tetl, address, familycode, ismarried);
		Chper chper = new Chper(rccardnum, idnumber, medicalnum, person);
		chper.add();

		req.getRequestDispatcher("FamilyServlet?method=familyList").forward(req, resp);
	}

}

	 * @param req
	 * @param resp
	 * @throws ServletException
	 * @throws IOException
	 */
	public void toUpdate(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException{
		String illcode=req.getParameter("illcode");
		ChronicdisDao chronicdis=new ChronicdisDao();
		Chronicdis quertByIllcode = chronicdis.quertByIllcode(illcode);
		req.setAttribute("quertByIllcode", quertByIllcode);
		req.getRequestDispatcher("/page/chronicdis/chronicdis_edit.jsp").forward(req, resp);
	}
	
	
	public void addChronicdis(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException{
		String illcode=req.getParameter("illcode");
		String illname=req.getParameter("illname");
		String  pycode=req.getParameter("pycode");
		
		Chronicdis chronicdis=new Chronicdis(illcode,illname,pycode);
		chronicdis.add();
		req.getRequestDispatcher("ChronicdisServlet?method=chronicdisList").forward(req, resp);
	}
	
	public void updateChronicdis(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException{
		String illcode=req.getParameter("illcode");
		String illname=req.getParameter("illname");
		String  pycode=req.getParameter("pycode");
		
		Chronicdis chronicdis=new Chronicdis(illcode,illname,pycode);
		chronicdis.update();
		req.getRequestDispatcher("ChronicdisServlet?method=chronicdisList").forward(req, resp);
	}
	
	

}

				System.out.println("method="+method);
				//放行所有静态资源
				
				if(uri.startsWith("/medical1/css/") ||uri.startsWith("/medical1/images/") ||
						uri.startsWith("/medical1/js/")||uri.startsWith("/medical1/third/")||
						uri.equals("/medical1/")||uri.equals("/medical1/page/user/main.jsp")||
						uri.equals("/medical1/userData")&&method.equals("userLogin")||uri.equals("/medical1/page/user/user_login.jsp")){
					System.out.println("==============================");
					chain.doFilter(request, response);
				}else{
					//获取Session对象
					HttpSession session = req.getSession();
					User obj=(User)session.getAttribute("loginSuccess");
					if(obj!=null){
						//获取用户的权限
						    //通过用户的id获取用户的权限
						MenuDao md=new MenuDao();
						List<String> ls=md.selMenubyRoleid(obj.getUserid());
						//权限校验
						for (String u : ls) {
							if(u.equals(method)||u.equals(uri)){
								chain.doFilter(request, response);
								return;
							}
						}
						//响应
						resp.getWriter().write("power");
						return;
						
					}else{
						//重定向到登录页面
						resp.sendRedirect("/medical1/WebRoot/page/user/user_login.jsp");
					}
					
					
				}
	}

	@Override
	public void init(FilterConfig arg0) throws ServletException {
		
		
	}

	

	}
	 
	
}
	
public void selRole(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException{
	String roleid=req.getParameter("roleid");
	rd=new RoleDao();
	int delRole = rd.delRole(roleid);
	//HttpSession session = req.getSession();
	if(delRole>0){
		req.getRequestDispatcher("roleData?method=roleManager").forward(req, resp);
	}else{
		
	}
}

public void addRole(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException{
	String roleid = req.getParameter("roleid");
    String roleName = req.getParameter("roleName");
    HttpSession session = req.getSession();
    
    rd=new RoleDao();
    int  num = rd.addRole(roleid, roleName);
    if(num>0){
       req.getRequestDispatcher("roleData?method=roleManager").forward(req, resp);
    }else{
    	session.setAttribute("flag", "addflase");
    	req.getRequestDispatcher("page/role/add_role.jsp").forward(req, resp);
    }
    
}

/**
 * @param req
 * @param resp
 * @throws IOException 
 * @throws ServletException 
 * @throws SQLException 
 */
	 * 添加
	 * 
	 * @param req
	 * @param resp
	 * @throws ServletException
	 * @throws IOException
	 */
	public void addChper(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

		String rccardnum = req.getParameter("rccardnum");
		String medicalnum = req.getParameter("medicalnum");

		String name = req.getParameter("name");
		String relation = req.getParameter("relation");
		String idnumber = req.getParameter("idnumber");
		String sex = req.getParameter("sex");
		String ishealthy = req.getParameter("ishealthy");
		String nation = req.getParameter("nation");
		String culture = req.getParameter("culture");
		int age = Integer.parseInt(req.getParameter("age"));
		String brithday = req.getParameter("brithday");
		String perattr = req.getParameter("perattr");
		String isvillage = req.getParameter("isvillage");
		String vocation = req.getParameter("vocation");
		String company = req.getParameter("company");
		String tetl = req.getParameter("tetl");
		String ismarried = req.getParameter("ismarried");
		String address = null;
		String familycode = req.getParameter("familycode");

		String countycode = req.getParameter("countycode");
		String towncode = req.getParameter("towncode");
		String villagecode = req.getParameter("villagecode");
		String groupcode = req.getParameter("groupcode");
		String details = req.getParameter("details");
		AreaDao ad = new AreaDao();

		if (groupcode == null && details == null) {
			address = ad.queryAreaByCode(countycode).getAreaname() + ad.queryAreaByCode(towncode).getAreaname()
					+ ad.queryAreaByCode(villagecode).getAreaname();
		} else if (details == null) {
			address = ad.queryAreaByCode(countycode).getAreaname() + ad.queryAreaByCode(towncode).getAreaname()
					+ ad.queryAreaByCode(villagecode).getAreaname() + ad.queryAreaByCode(groupcode).getAreaname();
		} else {
			address = ad.queryAreaByCode(countycode).getAreaname() + ad.queryAreaByCode(towncode).getAreaname()
					+ ad.queryAreaByCode(villagecode).getAreaname() + ad.queryAreaByCode(groupcode).getAreaname()
					+ details;
		}

		// address=countycode+towncode+villagecode+groupcode+details;

		Person person = new Person(null, name, relation, idnumber, sex, ishealthy, nation, culture, age, brithday,
				perattr, isvillage, vocation, company, tetl, address, familycode, ismarried);
		String instypecode = req.getParameter("instypecode");
		String sponsorunit = req.getParameter("sponsorunit");
		String practice = req.getParameter("practice");
		String representative = req.getParameter("representative");
		double regcapital = Double.parseDouble(req.getParameter("regcapital"));
		MedicalIns medical = new MedicalIns(inscode, insname, areacode, subcode, ecocode, levelcode, fixedpoindcode,
				pfixedpoindcode, instypecode, sponsorunit, practice, representative, regcapital);
		medical.add();
		req.getRequestDispatcher("miData?method=miList").forward(req, resp);
		
	}
	
	
	
	
	
	public void delMedical(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
		String inscode=req.getParameter("inscode");
		MedicalIns medicalins = new MedicalIns(inscode);
		medicalins.del();
		req.getRequestDispatcher("miData?method=miList").forward(req, resp);
		
	}

	public void toAdd(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
		EconomicType etype = new EconomicType();
		FixedPoind fpoind = new FixedPoind();
		InsLevel level = new InsLevel();
		InsType insType = new InsType();
		Subjection sub = new Subjection();
		AreaDao areaDao=new AreaDao();
		List<EconomicType> etypeinfo = etype.query();
		List<FixedPoind> fpoindinfo = fpoind.query();
		List<InsLevel> levelinfo = level.query();
		List<InsType> insTypeinfo = insType.query();
		List<Subjection> subinfo = sub.query();
		List<Area> allArea = areaDao.allArea();
		
		req.setAttribute("etypeinfo", etypeinfo);
		req.setAttribute("fpoindinfo", fpoindinfo);
		req.setAttribute("levelinfo", levelinfo);
		req.setAttribute("insTypeinfo", insTypeinfo);
		req.setAttribute("subinfo", subinfo);
		req.setAttribute("allArea", allArea);
		req.getRequestDispatcher("/page/medical/medical_add.jsp").forward(req, resp);
		;
	}

}

			userManager(req, resp);
		}
	}
/**
 * 用户删除
 * @param req
 * @param resp
 * @throws ServletException
 * @throws IOException
 */
	
   public void delUser(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException{
	   String userid = req.getParameter("userid");
	   int num = ud.delUser(userid);
	   if(num>0){
		  req.getRequestDispatcher("userData?method=userManager").forward(req, resp); 
	   }else{
		   
	   }
   }
   
   public void selUser(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException{
	   String userid=req.getParameter("userid");
	   String sql="select * from t_user where userid=?";
	   User userinfo = ud.selUserByUserid(sql,userid);
	   
	   if(userinfo!=null){
       req.setAttribute("showUser", userinfo);
	   req.getRequestDispatcher("page/user/user_update.jsp").forward(req, resp);
	   }
   }
   
   public void updUser(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException{
	    String userid = req.getParameter("userid");
	    String pwd = req.getParameter("pwd");
	    String fullName = req.getParameter("fullName");
	    int num = ud.updUser(userid, pwd, fullName);
	     HttpSession session = req.getSession();
	     
	    if(num>0){
	        req.getRequestDispatcher("userData?method=userManager").forward(req, resp);
	    }else{
			session.setAttribute("flag", "updfalse");
			resp.sendRedirect("userData?method=selUser");
	    }
   }
                          
}

	public void addIllnum(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String idnumber = req.getParameter("idnumber");
		String illcode = req.getParameter("illcode");
		String starttime = req.getParameter("starttime");
		String endtime = req.getParameter("endtime");
		System.out.println("是否接到身份证?"+idnumber);
		System.out.println("是否接到慢性病?"+illcode);
		System.out.println("是否接到开始时间?"+starttime);
		System.out.println("是否接到结束时间?"+endtime);
		ChperDao ch = new ChperDao();
		Illnum i = new Illnum(null, null, idnumber, illcode, starttime, endtime);
		i.add();
		req.getRequestDispatcher("IllnumServlet?method=illnumList").forward(req, resp);
	}

	public void updateIllnum(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

		String illcode = req.getParameter("illcode");
		String illcardnum = req.getParameter("illcardnum");
		String endtime = req.getParameter("endtime");

		Illnum i = new Illnum(illcardnum, null, null, illcode, null, endtime);
		i.update();
		req.getRequestDispatcher("IllnumServlet?method=illnumList").forward(req, resp);
	}

}

public class InsServlet extends BaseServlet {
	
							if(u.equals(method)||u.equals(uri)){
								chain.doFilter(request, response);
								return;
							}
						}
						//响应
						resp.getWriter().write("power");
						return;
						
					}else{
						//重定向到登录页面
						resp.sendRedirect("/medical1/WebRoot/page/user/user_login.jsp");
					}
					
					
				}
	}

	@Override
	public void init(FilterConfig arg0) throws ServletException {
		
		
	}

	

}

public class MenuServlet extends BaseServlet {
	
	MenuDao md=null;
	public void selMenus(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException{
		MedicalInsDao medicalinsdao = new MedicalInsDao();
		List<MedicalIns> find = medicalinsdao.find(search);
		resp.setContentType("html/text;charset=utf-8");
		resp.getWriter().println(new Gson().toJson(find));
	
		
	}

	public void addMedical(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
		String inscode = req.getParameter("inscode");
		String insname = req.getParameter("insname");
		String areacode = req.getParameter("areacode");
		int subcode = Integer.parseInt(req.getParameter("subcode"));
		int levelcode = Integer.parseInt(req.getParameter("levelcode"));
		int fixedpoindcode = Integer.parseInt(req.getParameter("fixedpoindcode"));
		int pfixedpoindcode = Integer.parseInt(req.getParameter("pfixedpoindcode"));
		int ecocode = Integer.parseInt(req.getParameter("ecocode"));
		String instypecode = req.getParameter("instypecode");
		String sponsorunit = req.getParameter("sponsorunit");
		String practice = req.getParameter("practice");
		String representative = req.getParameter("representative");
		double regcapital = Double.parseDouble(req.getParameter("regcapital"));
		MedicalIns medical = new MedicalIns(inscode, insname, areacode, subcode, ecocode, levelcode, fixedpoindcode,
				pfixedpoindcode, instypecode, sponsorunit, practice, representative, regcapital);
		medical.add();
		req.getRequestDispatcher("miData?method=miList").forward(req, resp);
		
	}
	
	
	
	
	
	public void delMedical(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
		String inscode=req.getParameter("inscode");
		MedicalIns medicalins = new MedicalIns(inscode);
		medicalins.del();
		req.getRequestDispatcher("miData?method=miList").forward(req, resp);
		
	}
		ChperDao chperDao = new ChperDao();
		PersonDao pd = new PersonDao();
		ChpayDao cd = new ChpayDao();
		PolicyDao policyDao = new PolicyDao();
		Policy policy = policyDao.queryByYears(i);
		List<Chper> lc = new ArrayList<Chper>();
		List<Person> lp = pd.queryByFamilycode(familycode, null);
		//通过家庭编号和名字查询家庭成员
		double upperlimit = policy.getUpperlimit();
		//得到当年缴费标准
		for (Person person : lp) {
			Chper chper = chperDao.queryByIdnumber(person.getIdnumber(), null);
			//通过个人身份证号得到农合证号信息
			if (chper != null) {
				//通过农合信息号查询
				boolean flag = cd.queryByid(chper.getRccardnum());
				//
				Chpay chpay = null;
				if (flag == false) {
					Chper idnumber = chperDao.queryByIdnumber(null, chper.getRccardnum());
					lc.add(idnumber);
				} else {
					chpay = cd.queryByCode(chper.getRccardnum(), upperlimit);
					Chper idnumber = chperDao.queryByIdnumber(null, chpay.getRccardnum());
					if (idnumber != null) {
						lc.add(idnumber);
					}
				}
			}
		}

		req.setAttribute("lc", lc);

		req.getRequestDispatcher("/page/chpay/chpay_edit.jsp").forward(req, resp);
	}

	/**
	 * 缴费
	 * 
	 * @param req
	 * @param resp
	 * @throws IOException
	 */

public void delRole(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException{
	String roleid = req.getParameter("roleid");
    rd=new RoleDao();
    int delRole = rd.delRole(roleid);
    if(delRole>0){
		  req.getRequestDispatcher("roleData?method=roleManager").forward(req, resp); 

    }
}
}

public class MenuFilter  implements Filter{

	@Override
	public void destroy() {
		System.out.println("我呜呜呜呜呜呜呜呜呜destroy()");
		
	}

	@Override
	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
			throws IOException, ServletException {

		//设置请求编码格式
				request.setCharacterEncoding("utf-8");
				//设置响应编码格式

public class RcorgServlet extends BaseServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public void update(HttpServletRequest req, HttpServletResponse resp)
			throws SQLException, ServletException, IOException {
		String orgcode = req.getParameter("orgcode");
		String orgname = req.getParameter("orgname");
		String areacode = req.getParameter("areacode");
		RCOrg org = new RCOrg(orgcode, orgname, areacode);
		org.edit();
		req.getRequestDispatcher("rcData?method=rcorgList").forward(req, resp);
	}

	public void toUpdate(HttpServletRequest req, HttpServletResponse resp)
			throws SQLException, ServletException, IOException {
		String orgcode = req.getParameter("orgcode");
		RCOrgDao rcorgDao = new RCOrgDao();
		AreaDao areaDao = new AreaDao();
		RCOrg rcorg = rcorgDao.queryByid(orgcode);
		Area area = areaDao.queryAreaByCode(rcorg.getAreacode());
		AreaTree areaTree = new AreaTree("0");
		List<TreeNode> childNodeList = areaTree.getChildNodeList();
		req.setAttribute("area", area);
		req.setAttribute("childNodeList", childNodeList);
		req.setAttribute("rcorg", rcorg);
		req.getRequestDispatcher("page/rcorg/rcorg_edit.jsp").forward(req, resp);

	}

	public void rcQuery(HttpServletRequest req, HttpServletResponse resp)
			throws SQLException, ServletException, IOException {
	   int num = ud.delUser(userid);
	   if(num>0){
		  req.getRequestDispatcher("userData?method=userManager").forward(req, resp); 
	   }else{
		   
	   }
   }
   
   public void selUser(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException{
	   String userid=req.getParameter("userid");
	   String sql="select * from t_user where userid=?";
	   User userinfo = ud.selUserByUserid(sql,userid);
	   
	   if(userinfo!=null){
       req.setAttribute("showUser", userinfo);
	   req.getRequestDispatcher("page/user/user_update.jsp").forward(req, resp);
	   }
   }
   
   public void updUser(HttpServletRequest req,HttpServletResponse resp) throws ServletException, IOException{
	    String userid = req.getParameter("userid");
	    String pwd = req.getParameter("pwd");
	    String fullName = req.getParameter("fullName");
	    int num = ud.updUser(userid, pwd, fullName);
	     HttpSession session = req.getSession();
	     
	    if(num>0){
	        req.getRequestDispatcher("userData?method=userManager").forward(req, resp);
	    }else{
			session.setAttribute("flag", "updfalse");
			resp.sendRedirect("userData?method=selUser");
	    }
   }
                          
}

	
	
	
	
	
	public void delMedical(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
		String inscode=req.getParameter("inscode");
		MedicalIns medicalins = new MedicalIns(inscode);
		medicalins.del();
		req.getRequestDispatcher("miData?method=miList").forward(req, resp);
		
	}

	public void toAdd(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
		EconomicType etype = new EconomicType();
		FixedPoind fpoind = new FixedPoind();
		InsLevel level = new InsLevel();
		InsType insType = new InsType();
		Subjection sub = new Subjection();
		AreaDao areaDao=new AreaDao();
		List<EconomicType> etypeinfo = etype.query();
		List<FixedPoind> fpoindinfo = fpoind.query();
		List<InsLevel> levelinfo = level.query();
		List<InsType> insTypeinfo = insType.query();
		List<Subjection> subinfo = sub.query();
		List<Area> allArea = areaDao.allArea();
		
		req.setAttribute("etypeinfo", etypeinfo);
		req.setAttribute("fpoindinfo", fpoindinfo);
		req.setAttribute("levelinfo", levelinfo);
		req.setAttribute("insTypeinfo", insTypeinfo);
		req.setAttribute("subinfo", subinfo);
		req.setAttribute("allArea", allArea);
		req.getRequestDispatcher("/page/medical/medical_add.jsp").forward(req, resp);
		;
	}

}

	 * @param req
	 * @param resp
	 * @throws ServletException
	 * @throws IOException
	 */

	public void chpayList(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

		String pageNo = req.getParameter("pageNo");
		int p = pageNo == null ? 1 : Integer.parseInt(pageNo);
		ChpayDao chpay = new ChpayDao();
		Page chpaypage = chpay.queryAll(p, Constant.ROW);
		int prePage = chpaypage.prePage();
		int lastPage = chpaypage.lastPage();
		boolean last = chpaypage.isLast();
		List<Integer> linkLumbers = chpaypage.linkLumbers();
		List datas = chpaypage.getDatas();
		req.setAttribute("chpaypage", chpaypage);
		req.setAttribute("datas", datas);
		req.setAttribute("prePage", prePage);
		req.setAttribute("lastPage", lastPage);
		req.setAttribute("linkLumbers", linkLumbers);
		req.setAttribute("last", last);

		req.getRequestDispatcher("/page/chpay/chpay_list.jsp").forward(req, resp);
	}

	/**
	 * 查询本镇下面所有同名的户主
	 * 
	 * @param req
	 * @param resp
	 * @throws ServletException
	 * @throws IOException
	 */
	public void chpayPay(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String householder = req.getParameter("householder");
		// 存储数据
		Map<String, Object> map = new HashMap<String, Object>();

	private static final long serialVersionUID = 1L;
	UserDao ud = new UserDao();

	/**
	 * 用户登录controller
	 * 
	 * @param req
	 * @param resp
	 * @throws IOException
	 */
	public void userLogin(HttpServletRequest req, HttpServletResponse resp)
			throws IOException {
		// 获取请求信息
		String userid = req.getParameter("userid");
		String pwd = req.getParameter("pwd");
		// 处理请求信息
		String sql="select * from t_user where userid=? and pwd =?";
		User u = ud.userLogin(sql,userid, pwd);
		HttpSession hs = req.getSession();
		if (u != null) {
			hs.setAttribute("loginSuccess", u);
			resp.sendRedirect("page/user/main.jsp");
		} else {
			hs.setAttribute("flag", "loginFailed");
			resp.sendRedirect("page/user/user_login.jsp");
		}
	}

	/**
	 * 用户退出登录
	 * 
	 * @param req
	 * @param resp
	 */
	 public void userOut(HttpServletRequest req, HttpServletResponse resp) {
		HttpSession session = req.getSession();
		session.invalidate();
		try {
			resp.sendRedirect("page/user/user_login.jsp");
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
/**
 *显示所有用户信息
 * @param req
 * @param resp

请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述
请添加图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值