Onlinebooking
Onlinebooking
jsp
<%--
Document : index
Created on : 11 Nov, 2024, 11:20:34 AM
Author : 251056
--%>
DBConnection.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author 251056
*
*/
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
Booking.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author 251056
*/
public class Booking {
private String customerName;
private String email;
private String roomType;
private String checkInDate;
private String checkOutDate;
BookingServlet.java
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/BookingServlet")
public class BookingServlet extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
Bookingform.jsp
<%--
Document : Bookingform
Created on : 11 Nov, 2024, 11:29:24 AM
Author : 251056
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Online Booking Form</title>
</head>
<body>
<h1>Book a Room</h1>
<form action="BookingServlet" method="post">
<label for="customerName">Name:</label><br>
<input type="text" id="customerName" name="customerName" required><br><br>
<label for="email">Email:</label><br>
<input type="email" id="email" name="email" required><br><br>
<input type="submit">
</form>
</body>
</html>
conformationjsp.jsp
<%--
Document : conformationjsp
Created on : 11 Nov, 2024, 11:30:21 AM
Author : 251056
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Booking Confirmation</title>
</head>
<body>
<h1>Booking Successful!</h1>
<p>Your room has been booked. We will send a confirmation email shortly.</p>
</body>
</html>