Create a web page for reservation which provides the hotel r

Create a web page for reservation which provides the hotel room information, and allow users to input their personal information, reservation details and farther submit their reservation. Create a confirmation page which can show all of the detailed personal and reservation information that users provided in the reservation page. Bonus: create and use cookies for the First name, Last name. Phone, and Email.

Solution

html code

<html>
<head><center><h2>Welcome to ABC Hotel</h2></center></head>
<body>

<b>Room Information</b>

<table border = \"1\">
<tr><th>Room Type</th><th>Picture</th><th>Price</th></tr>
<tr><td>Standard</td><td><img src=\"img1.jpg\" width = \"300\" height=\"200\"></td><td>USD120</td></tr>
<tr><td>Classic</td><td><img src=\"img2.jpg\" width = \"300\" height=\"200\"></td><td>USD160</td></tr>
<tr><td>Family Room</td><td><img src=\"img3.jpg\" width = \"300\" height=\"200\"></td><td>USD200</td></tr>
</table>
<br>
<form action=\"createCookie.jsp\" method = \"POST\">
<b>Personal Information</b><br>
<b> First Name: </b> <input type=\"text\" name = \"fname\"><br>
<b> Last Name: </b> <input type=\"text\" name = \"lname\"><br>
<b> Phone: </b> <input type=\"text\" name = \"phone\"><br>
<b> Email: </b> <input type=\"text\" name = \"email\"><br>
<b> Country: </b><select name = \"country\">
                   <option>USA</option>
                   <option>UK</option>
               </select>
               <br><br>
              
<b>Reservation Details</b><br>
<b> Date Check In: </b> <input type=\"text\" name = \"checkin\"><br>
<b> Date Check Out: </b> <input type=\"text\" name = \"checkout\"><br>
<b> Type of Room: </b><select name = \"room_type\">
                   <option>Standard</option>
                   <option>Classic</option>
                   <option>Family Room</option>                  
               </select><br>
<b> Number of Persons: </b><select name = \"number\">
                   <option>1</option>
                   <option>2</option>
                   <option>3</option>                  
                   <option>4</option>                                      
               </select><br>
               <br>
              
<input type = \"submit\" value = \"SUBMIT\">
</form>
</body>
</html>              
              

JSP for cookie creation and confirmation page

<%
   String first_name = request.getParameter(\"fname\");
   String last_name = request.getParameter(\"lname\");
   String phone = request.getParameter(\"phone\");
   String email = request.getParameter(\"email\");
   String country = request.getParameter(\"country\");              
  
   String checkin = request.getParameter(\"checkin\");
   String checkout = request.getParameter(\"checkout\");
   String room_type = request.getParameter(\"room_type\");
   String persons = request.getParameter(\"number\");  

//creating of cookies
Cookie fname = new Cookie(\"fname\", first_name));
Cookie lname = new Cookie(\"fname\", last_name));


fname.setMaxAge(60*60*24);
lname.setMaxAge(60*60*24);


response.addCookie( fname );
response.addCookie( lname );


%>

<b>CONFIRMATION PAGE</b>
First Name <%=first_name%><br />
Last Name <%=last_name%><br />
Phone <%=phone%><br />
Email <%=email%><br />
Country <%=country%><br />
Checkin <%=checkin%><br />
Checkout <%=checkout%><br />
Room type <%=room_type%><br />
Number of persons <%=persons%><br />

 Create a web page for reservation which provides the hotel room information, and allow users to input their personal information, reservation details and farth
 Create a web page for reservation which provides the hotel room information, and allow users to input their personal information, reservation details and farth

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site