Ejemplo n.º 1
0
  /** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String pattern = request.getParameter("pattern");
    log.debug("Get find pattern from request --> " + pattern);

    List<Book> books = service.findByTitle(pattern);
    log.debug("Get books from BookService --> " + books);
    request.setAttribute("books", books);
    log.trace("Set books to the session --> " + books);
    request.getRequestDispatcher("list.jsp").forward(request, response);
    log.trace("Redirect to list.jsp");
  }
Ejemplo n.º 2
0
 @Override
 public void init() throws ServletException {
   super.init();
   ServletContext ctx = getServletContext();
   service = (BookService) ctx.getAttribute("BookService");
   log.trace("Get attribute BookService --> " + service);
 }