protected void shenhedetail(HttpServletRequest req,HttpServletResponse resp)throws ServletException,IOException { req.setCharacterEncoding("utf-8"); int id=StringUtil.StringToInt(req.getParameter("id")); Xuqiuservice xuqiuservice=new Xuqiuservice(); Zhengjibean zhengjibean=xuqiuservice.searchneed(id); req.setAttribute("zhengjibean", zhengjibean); req.getRequestDispatcher("/index/shenhedetail.jsp").forward(req, resp); }
public Zhengjibean searchneed(int id) { Session session = HibernateUtils.getCurrentSession(); Transaction tr = session.beginTransaction(); Zhengjibean zhengjibean=null; try { zhengjibean=new Xuqiudao().searchneed(id);; tr.commit(); } catch (Exception e) { e.printStackTrace(); tr.rollback(); } return zhengjibean; }
public Zhengjibean searchneed(int id) { Session session = HibernateUtils.getCurrentSession(); Zhengjibean zhengjibean = session.get(Zhengjibean.class, id); return zhengjibean; }