今天是角色管理的最后的一个模板;
protected void jueselist(HttpServletRequest req,HttpServletResponse resp)throws ServletException,IOException { req.setCharacterEncoding("utf-8"); Userservice userservice=new Userservice(); List<Juesebean> jueselist=userservice.jueselist(); resp.setCharacterEncoding("utf-8"); PrintWriter out = resp.getWriter(); out.print(JSON.toJSONString(jueselist)); out.flush(); out.close(); }
protected void fenpeijuese(HttpServletRequest req,HttpServletResponse resp)throws ServletException,IOException { req.setCharacterEncoding("utf-8"); int userid=StringUtil.StringToInt(req.getParameter("qxuserid")); String qxjuese=req.getParameter("qxjuese"); new Quanxianservice().fenpeiquan(userid,qxjuese); resp.setCharacterEncoding("utf-8"); PrintWriter out = resp.getWriter(); out.print(JSON.toJSONString("1")); out.flush(); out.close(); }
public void fenpeiquan(int userid, String qxjuese) { Session session = HibernateUtils.getCurrentSession(); Transaction tr = session.beginTransaction(); try { new Quanxiandao().fenpeiquan(userid,qxjuese); tr.commit(); } catch (Exception e) { e.printStackTrace(); tr.rollback(); } }