Guest User

Untitled

a guest
Nov 16th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. @Override
  2. protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  3. System.out.println("Chamando doGet");
  4.  
  5. PrintWriter resposta = resp.getWriter();
  6. resposta.println("<html><body>");
  7. resposta.println("<strong>TESTANDO FORTE</strong>");
  8.  
  9. resposta.println("<ul>");
  10. for (Artista u : new ArtistaDAO().getArtistas()) {
  11. resposta.println("<li>" + u.getNome() + "</li>");
  12. }
  13. resposta.println("</ul>");
  14.  
  15.  
  16. resposta.println("</body></html>");
  17.  
  18. RequestDispatcher disp = req.getRequestDispatcher("/WEB-INF/views/inicio.jsp");
  19. disp.forward(req, resp);
  20. }
  21.  
  22. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
  23. ...
  24. ...
  25. ...
  26. <c:forEach items="${nomeartistas}" var="artista">
  27. <li>${artista.getNome()}</li>
  28. </c:forEach>
  29.  
  30. @Override
  31. protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
  32.  
  33. req.setAttribute("nomeartistas", new ArtistaDAO().getArtistas());
  34. req.getRequestDispatcher("inicio.jsp").forward(req, resp);
  35. }
Add Comment
Please, Sign In to add comment