Guest User

Untitled

a guest
Mar 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. protected void processRequest(HttpServletRequest request, HttpServletResponse response)
  2. throws ServletException, IOException {
  3. response.setContentType("text/html;charset=UTF-8");
  4. try (PrintWriter out = response.getWriter()) {
  5. /* TODO output your page here. You may use following sample code. */
  6. String Patid = request.getParameter("patientid");
  7. String name1 = request.getParameter("myname");
  8. String [] checkbok = request.getParameterValues("lang");
  9.  
  10. for (int i = 0; i < checkbok.length; i++)
  11. {
  12. out.println("<h1>" + checkbok[i] + "</h1>");
  13. }
  14.  
  15. System.out.println(Patid+name1+checkbok[1]);
  16. Configuration cf = new Configuration();
  17. cf.configure("hibernate.cfg.xml");
  18. SessionFactory sf = cf.buildSessionFactory();
  19. Session s = sf.openSession();
  20. Transaction t = s.beginTransaction();
  21. Checkb vis = new Checkb(Patid, name1, checkbok);
  22.  
  23. s.save(vis);
  24. t.commit();
  25. s.close();
  26. sf.close();
  27.  
  28. RequestDispatcher rd = request.getRequestDispatcher("login.html");
  29. rd.forward(request, response);
Add Comment
Please, Sign In to add comment