protected void processusTraiteRequete(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException, ParseException {
    String actionName = request.getParameter(ACTION_TYPE);
    String destinationPage = ERROR_PAGE;

    ReservationService unService = new ReservationService();
    if (LISTE_RESERVATION.equals(actionName)) {
      try {
        request.setAttribute("listeResa", unService.consulterReservation());
      } catch (MonException e) {
        e.printStackTrace();
      }

      destinationPage = "/listeReservations.jsp";
    } else if (SUPPRIMER_OEUVRE.equals(actionName)) {
      int idOeuvre = Integer.parseInt(request.getParameter("txtid"));

      try {
        unService.supprimeResa(idOeuvre);

        OeuvreService oeuvreService = new OeuvreService();
        Oeuvrevente oeuvre = oeuvreService.getOeuvre(idOeuvre);
        oeuvre.setEtatOeuvrevente("L");
        oeuvreService.modifierOeuvre(oeuvre);

      } catch (MonException e) {
        e.printStackTrace();
      }
      destinationPage = "/Reservation?action=listeReservation";
    }

    RequestDispatcher dispatcher = getServletContext().getRequestDispatcher(destinationPage);
    dispatcher.forward(request, response);
  }
Пример #2
0
  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    int idAdherent = Integer.parseInt(req.getParameter("id"));
    AdherentService adherentService = new AdherentService();

    Adherent adherent = null;
    try {
      adherent = adherentService.consulterAdherent(idAdherent);
    } catch (MonException e) {
      e.printStackTrace();
    }

    req.setAttribute(ATT_ADHERENT, adherent);

    RequestDispatcher dispatcher =
        getServletContext().getRequestDispatcher("/WEB-INF/editerAdherent.jsp");
    dispatcher.forward(req, resp);
  }