src/java/Controllers/HotelController.java
/**
     * Handles the HTTP <code>GET</code> method.
     *
     * @param request servlet request
     * @param response servlet response
     * @throws ServletException if a servlet-specific error occurs
     * @throws IOException if an I/O error occurs
     */
Handles the HTTP GET method.

@param request servlet request
@param response servlet response
@throws ServletException if a servlet-specific error occurs
@throws IOException if an I/O error occurs
Handles the HTTP GET method . @param request servlet request @param response servlet response @throws ServletException if a servlet - specific error occurs @throws IOException if an I / O error occurs
@Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
    {
        HttpSession session = request.getSession(false);
        if (session == null || session.getAttribute("user_id") == null) 
        {
            RequestDispatcher rd = request.getRequestDispatcher("views/404.jsp");
            rd.forward(request, response);
        }
        String id = request.getParameter("id");
        if(id == null || id.equals(""))
        {
            RequestDispatcher rd = request.getRequestDispatcher("views/404.jsp");
            rd.forward(request, response);
            return;
        }
        Integer intId = Integer.parseInt(id);
        this.hotel = this.hotelDAO.get(intId);
        if(this.hotel == null || session.getAttribute("user_id") == null )
        {
            RequestDispatcher rd = request.getRequestDispatcher("views/404.jsp");
            rd.forward(request, response);
            return;
        }
        this.rooms = this.roomDAO.getAllWhere("hotel_id", intId);
        this.userRate = this.rateDAO.getAllInner("hotel_id", intId);
        request.setAttribute("hotel", this.hotel);
        request.setAttribute("rooms", this.rooms);
        request.setAttribute("rates", this.userRate);
        RequestDispatcher rd = request.getRequestDispatcher("views/hotel.jsp");  
        rd.forward(request, response);
    }
@ Override protected void doGet ( HttpServletRequest request , HttpServletResponse response ) throws ServletException , IOException { HttpSession session = request . getSession ( false ) ; if ( session == null || session . getAttribute ( "user_id" ) == null ) { RequestDispatcher rd = request . getRequestDispatcher ( "views/404.jsp" ) ; rd . forward ( request , response ) ; } String id = request . getParameter ( "id" ) ; if ( id == null || id . equals ( "" ) ) { RequestDispatcher rd = request . getRequestDispatcher ( "views/404.jsp" ) ; rd . forward ( request , response ) ; return ; } Integer intId = Integer . parseInt ( id ) ; this . hotel = this . hotelDAO . get ( intId ) ; if ( this . hotel == null || session . getAttribute ( "user_id" ) == null ) { RequestDispatcher rd = request . getRequestDispatcher ( "views/404.jsp" ) ; rd . forward ( request , response ) ; return ; } this . rooms = this . roomDAO . getAllWhere ( "hotel_id" , intId ) ; this . userRate = this . rateDAO . getAllInner ( "hotel_id" , intId ) ; request . setAttribute ( "hotel" , this . hotel ) ; request . setAttribute ( "rooms" , this . rooms ) ; request . setAttribute ( "rates" , this . userRate ) ; RequestDispatcher rd = request . getRequestDispatcher ( "views/hotel.jsp" ) ; rd . forward ( request , response ) ; }
Handles the HTTP <code>GET</code> method.
Handles the HTTP <code > GET< / code > method .