Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. package lab8;
  2.  
  3. import lab8.Persoana;
  4. import java.io.IOException;
  5. import java.util.Vector;
  6.  
  7. import javax.servlet.ServletException;
  8. import javax.servlet.annotation.WebServlet;
  9. import javax.servlet.http.HttpServlet;
  10. import javax.servlet.http.HttpServletRequest;
  11. import javax.servlet.http.HttpServletResponse;
  12.  
  13. /**
  14. * Servlet implementation class Adaugare
  15. */
  16. @WebServlet("/Adaugare")
  17. public class Adaugare extends HttpServlet
  18. {
  19. private static final long serialVersionUID = 1L;
  20. private final Vector<Persoana> persons = new Vector<Persoana>();
  21.  
  22. /**
  23. * @see HttpServlet#HttpServlet()
  24. */
  25. public Adaugare()
  26. {
  27. super();
  28. }
  29.  
  30. /**
  31. * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
  32. */
  33. protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
  34. {
  35. String name = request.getParameter("name");
  36. String adress = request.getParameter("adress");
  37. String phone = request.getParameter("phone");
  38. String day = request.getParameter("day");
  39. String month = request.getParameter("month");
  40. String year = request.getParameter("year");
  41.  
  42. persons.add(new Persoana(name, day, month, year, adress, phone));
  43.  
  44. request.getSession().setAttribute("persons", persons);
  45. request.getRequestDispatcher("Vizualizare").forward(request, response);
  46.  
  47. response.sendRedirect("/lab8/Vizualizare");
  48. }
  49.  
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement