diff --git a/src/main/java/ma/yc/airafraik/web/RechercheVolController.java b/src/main/java/ma/yc/airafraik/web/RechercheVolController.java index aab6efa..0a67e57 100644 --- a/src/main/java/ma/yc/airafraik/web/RechercheVolController.java +++ b/src/main/java/ma/yc/airafraik/web/RechercheVolController.java @@ -38,7 +38,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se //TODO : if those information are not null then we will search for the vols Collection vols = searchVolsService.searchVols(origin,depart,departuredate,retourdate,"1"); req.setAttribute("vols",vols); - req.getRequestDispatcher("recherchePage.jsp").forward(req, resp); + req.getRequestDispatcher("recherche-page.jsp").forward(req, resp); } diff --git a/src/main/java/ma/yc/airafraik/web/RservationConfirmationController.java b/src/main/java/ma/yc/airafraik/web/RservationConfirmationController.java new file mode 100644 index 0000000..1a02f44 --- /dev/null +++ b/src/main/java/ma/yc/airafraik/web/RservationConfirmationController.java @@ -0,0 +1,47 @@ +package ma.yc.airafraik.web; + +import jakarta.servlet.ServletConfig; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebServlet; +import jakarta.servlet.http.HttpServlet; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import ma.yc.airafraik.core.Print; +import ma.yc.airafraik.entities.VolEntity; +import ma.yc.airafraik.service.SearchVolsService; +import ma.yc.airafraik.service.impl.SearchVolsServiceImpl; + +import java.io.IOException; +import java.util.Collection; + +@WebServlet(name = "RservationConfirmationController", value = "/reservation-confirmation") +public class RservationConfirmationController extends HttpServlet { + + private SearchVolsService searchVolsService ; + @Override + public void init(ServletConfig config) throws ServletException { + super.init(config); + this.searchVolsService = new SearchVolsServiceImpl(); + } + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + String id = req.getParameter("id"); + + if (id != null) { + Print.log("id : " + id); + VolEntity vols = searchVolsService.searchVolParId(id); + req.setAttribute("vols",vols); + req.getRequestDispatcher("reservation-confirmation.jsp").forward(req, resp); + + }else{ + resp.sendRedirect("/"); + } + super.doGet(req, resp); + } + + @Override + protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + super.doPost(req, resp); + } +} diff --git a/src/main/java/ma/yc/airafraik/web/RservationDetailsController.java b/src/main/java/ma/yc/airafraik/web/RservationDetailsController.java index 50a6abc..71e47ff 100644 --- a/src/main/java/ma/yc/airafraik/web/RservationDetailsController.java +++ b/src/main/java/ma/yc/airafraik/web/RservationDetailsController.java @@ -36,13 +36,15 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se String id = req.getParameter("id"); Print.log("id : " + id); -// VolEntity reservationEntity = searchVolsService.searchVolParId(id); + VolEntity vol = searchVolsService.searchVolParId(id); + req.setAttribute("vol",vol); + //TODO : we will use this attribute in the jsp page // try{ // if (reservationEntity != null){ // req.setAttribute("reservation",reservationEntity); if (id != null) { - req.getRequestDispatcher("reservation-details.jsp").forward(req, resp); + req.getRequestDispatcher("reservation-confirmation-page.jsp").forward(req, resp); }else{ resp.sendRedirect("/"); } diff --git a/src/main/webapp/recherchePage.jsp b/src/main/webapp/recherche-page.jsp similarity index 92% rename from src/main/webapp/recherchePage.jsp rename to src/main/webapp/recherche-page.jsp index 49e4340..9f6f5b6 100644 --- a/src/main/webapp/recherchePage.jsp +++ b/src/main/webapp/recherche-page.jsp @@ -29,7 +29,7 @@ -