Exemplo n.º 1
0
  private void updateBookUI(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String id = request.getParameter("id");
    Book b = bs.findBookById(Integer.parseInt(id));
    List<Category> list = bs.getAllCategories();
    request.setAttribute("b", b);
    request.setAttribute("list", list);

    request.getRequestDispatcher("/WEB-INF/jsp/updatebook.jsp").forward(request, response);
  }
Exemplo n.º 2
0
 private void delBook(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   String id = request.getParameter("id");
   if (id == null || id.equals("")) {
     request.setAttribute("message", "fail to delete the book...");
   } else {
     BusinessService bs = new BusinessServiceImpl();
     bs.deleteBook(Integer.parseInt(id));
     request.setAttribute("message", "delete the book successfully...");
   }
   request.getRequestDispatcher("/message.jsp").forward(request, response);
 }
Exemplo n.º 3
0
  private void query(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    String name = request.getParameter("name");
    request.setAttribute("name", name);
    QueryInfo qi = WebUtils.request2Bean(request, QueryInfo.class);
    qi.setQueryString(name);

    BusinessService bsi = new BusinessServiceImpl();
    PageBean<Book> pb = bsi.querySpecficBook(qi);
    request.setAttribute("pb", pb);

    request.getRequestDispatcher("/WEB-INF/jsp/listbook.jsp").forward(request, response);
  }
Exemplo n.º 4
0
 private void listBook(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   //		List<Book> list = bs.getBooks();
   QueryInfo qi = WebUtils.request2Bean(request, QueryInfo.class);
   PageBean<Book> pb = bs.queryBook(qi);
   request.setAttribute("pb", pb);
   request.getRequestDispatcher("/WEB-INF/jsp/listbook.jsp").forward(request, response);
 }
Exemplo n.º 5
0
 private void addBookUI(HttpServletRequest request, HttpServletResponse response)
     throws ServletException, IOException {
   List<Category> list = bs.getAllCategories();
   request.setAttribute("list", list);
   request.getRequestDispatcher("/WEB-INF/jsp/addbook.jsp").forward(request, response);
 }