Online Room Reservation System

Online Room
Reservation System
Author: Ranjeet Devarakonda
December 2006
COSC 683
Submitted to: Dr. Michael Zeiger
Eastern Michigan University
Online Room Reservation System
Table of Contents
Business Description .................................................................................................................. 2
User Population.................................................................................................................... 3
Technology Preview............................................................................................................. 3
Description of the System........................................................................................................... 4
User Login ........................................................................................................................... 4
Administrator Login............................................................................................................. 4
General working of the system ................................................................................................... 5
Ajax Framework in Online Room Reservation System ............................................................... 6
Summary List of Use Cases........................................................................................................ 9
Use Cases and Preliminary User Interfaces
View Room Features ................................................................................................... 10
View Room Reservation Policies................................................................................. 11
Browse Room Availability .......................................................................................... 12
Search Room Availability............................................................................................ 13
Login to the System..................................................................................................... 15
Create a Reservation.................................................................................................... 16
View All Reservations................................................................................................. 18
Modify a Reservation .................................................................................................. 19
Delete a Reservation.................................................................................................... 21
Logout of the System .................................................................................................. 23
Send Reminder Email.................................................................................................. 24
Create a Reservation (Administrator) ........................................................................... 25
Modify a Reservation (Administrator) ......................................................................... 27
Delete a Reservation (Administrator) ........................................................................... 29
Print Room Reservations ............................................................................................. 31
Run Reports ................................................................................................................ 32
Testing and Error Correction .................................................................................................... 34
Sample Screens and Reports..................................................................................................... 35
Conclusion ............................................................................................................................... 37
Bibliography ............................................................................................................................ 38
2
Online Room Reservation System
Business Description
As collaboration and group projects have become more common at Client. Miracle software
and services has seen a steady increase in the number of users seeking group work space.
Currently, large tables and comfortable seating areas are available to accommodate groups,
but in the Fall 2007, Client will open group work rooms for its employees, clients and
business meetings. These rooms should provide more freedom and flexibility for group
work.
Problem:
In order to open these rooms as soon as possible, room reservations initially were been
handled at the reference desk located on the same floor as the room, with reservations made
in person or over the phone and recorded on paper. Anticipating heavy usage, Client would
like to centralize the reservation process, and allow reservations to be made online.
The main purpose of the Online Room Reservation System is to allow Client employees, and
clients to reserve a group work /collaborative work room online. To make a reservation, a
user will simply need to login, select a reservation date and time, and confirm the reservation.
When logged in, a user can also view, modify, and delete existing reservations. The system
will also send users a reservation reminder email.
Additional features of this Room Reservation System include browsing and searching the
room schedules and viewing room features. Browsing the schedules allows the user to see
room availability for a particular day. To search the schedules, a user selects a date and time.
If a room is available, the user is allowed to make a reservation, but if a room is not available,
the user has the option to search for another date and time or to browse the room availability.
Viewing room features allows the user to read about the group work rooms and watch a short
video clip showing a room.
3
Online Room Reservation System
The Room Reservation System administrator has additional privileges. The administrator
can view, modify, and delete reservations made by anyone, and the administrator can print a
daily schedule for each room to post outside each room. A variety of reports can also be run
by the administrator.
Client is excited about the Room Reservation System. The system will benefit users by
allowing them to create, modify and delete reservations online, and the system will benefit
the Company by centralizing the reservation process and allowing reports to be easily
created.
User Population
Users for this system are Miracle software systems employees (Managerial, Technical,
Clerical so on), and Customers/Clients. User population using the system at the same time is
expected to be 30 – 40 people.
Technology Preview
Front-end
HTML
CSS
JAVA
JavaScript
JSP
Servlets
XML/XSLT
SOAP
AJAX
Back-end
JDBC
Microsoft Access
IBM Web Sphere
4
Online Room Reservation System
Description of the System
Components
Online Room Reservation System is mainly divided into two modules
1) Administrator
2) Employee
As the word implies, Administrator has more privileges compared to a normal user to the
system.
Normal User Privileges:
 View all active reservations
 Add a new reservation
 Delete/Modify his reservation
 Search his reservation
 View available equipment in the room
Administrator‟s special Privileges:
 Add a new reservation
 Delete any reservation
 Modify any reservation
 Print a detail summary of the reservations made
 Add equipment to a room
 Search any reservation
5
Online Room Reservation System
General working of the system:
Every user has to be registered to login to the system. On the main login screen users are
prompted to enter their user name and password. Any employee who does not have username
and password can create a new account.
After logging in, User will have the following options:
Browse Room Availability
Search Room Availability
Create a Reservation
Delete a Reservation
View Active Reservations
Change User Information
Depending on their requirement they can choose any of the above and proceed with
reservation process.
6
Online Room Reservation System
AJAX framework in Online Room Reservation System
AJAX Technology has been implemented in „Search Room Availability‟ feature
Why AJAX?
The page-reload cycle presents one of the biggest usability obstacles in Web application
development and is a serious challenge for JAVA developers. AJAX (Asynchronous
JavaScript and XML) is a programming technique that lets programmer combine Java
technologies, XML, and JavaScript for Java-based Web applications that break the pagereload paradigm.
How AJAX is different?
An Ajax application eliminates the start-stop-start-stop nature of interaction on the Web by
introducing an intermediary – an Ajax engine – between the user and the server. It seems like
adding a layer to the application would make it less responsive, but the opposite is true.
Instead of loading a webpage, at the start of the session, the browser loads an Ajax engine –
written in JavaScript and usually tucked away in a hidden frame. This interface in responsible
for both rendering the interface the user sees and communicating with the server on the user‟s
behalf. Ajax engine allows the user‟s interaction with the application to happen
asynchronously – independent of communication with the server. So, the user is never
starting at a blank browser window and an hourglass icon, waiting around for the server to do
something.
7
Online Room Reservation System
AJAX Architecture
8
Online Room Reservation System
Ajax Parts in Online Room Reservation System
Represents AJAX implementation without a page reload
9
Online Room Reservation System
Summary List of Use Cases
1. View Room Features
2. View Room Reservation Policies
3. Browse Room Availability
4. Search Room Availability
5. Login to the System
6. Create a Reservation
7. View All Reservations
8. Modify a Reservation
9. Delete a Reservation
10. Log out of the System
11. Send a Room Reservation Email
12. Create a Reservation (Administrator)
13. Modify a Reservation (Administrator)
14. Delete a Reservation (Administrator)
15. Print Room Reservations
16. Run Reports
10
Online Room Reservation System
Use Case 1
Use Case Name: View Room Features
Summary:
User or system administrator views room features, which are described in text and
shown via streaming video.
Actors:
User or system administrator
Preconditions:
The user or system administrator must be at the room reservation home page.
Description ("Sunny Day Scenario"):
1. The user or system administrator clicks the link for the room reservation home page.
2. The user or system administrator is able to view the room features webpage.
[Exception: Room features page is not accessible]
3. The user or system administrator clicks the play button to watch the streaming video.
Exceptions ("Rainy Day Scenario"):
Room features page is not accessible:
Raised when the user is not able to get to the room features page after he clicks the
link for the page. The user or system administrators are alerted to the problem and
are allowed to attempt clicking the original link again.
Postconditions:
The user or system administrator views the room features page or they are unable to
view the schedules because of a problem with the server in processing the request.
11
Online Room Reservation System
Use Case 2
Use Case Name: View Room Reservation Policies
Summary:
User or system administrator views the room reservation policies
Actors:
User or system administrator
Preconditions:
The user or system administrator must be at the room reservation home page.
Description ("Sunny Day Scenario"):
1. The user or system administrator clicks the link for the room reservation policies.
2. The user or system administrator is able to view the room features webpage.
[Exception: Room reservation policies page is not accessible]
Exceptions ("Rainy Day Scenario"):
Room reservation policies page is not accessible:
Raised when the user is not able to get to the room reservation policies page after he
clicks the link for the page. The user or system administrators are alerted to the
problem and are allowed to attempt clicking the original link again.
Postconditions:
The user or system administrator views the room reservation policies page or they are
unable to view it because of a problem with the server in processing the request.
12
Online Room Reservation System
Use Case 3
Use Case Name: Browse Room Availability
Summary:
User or system administrator browses through the room reservation and availability
schedules.
Actors:
User or system administrator
Preconditions:
The user or system administrator must be at the room reservation home page or the at the
room reservation main menu.
Description ("Sunny Day Scenario"):
1. The user or system administrator clicks the browse room availability link.
2. The user or system administrator sees a table listing room availability by hour for that
day. [Exception: The requested page does not open]
3. The user or system administrator can use previous and next links to navigate through
the schedule day by day.
Exceptions ("Rainy Day Scenario"):
The requested page does not open:
Raised when the server is unable to process the request for displaying the schedules.
The user or system administrators are alerted to the problem and are allowed to
attempt clicking the original link again.
Postconditions:
The user or system administrator is able to view the current schedule for reservations
or they are unable to view the schedules because of a problem with the server in
processing the request.
13
Online Room Reservation System
Use Case 4
Use Case Name: Search Room Availability
Summary:
User or system administrator searches for a room schedule
Actors:
User or system administrator
Preconditions:
The user or system administrator must be at the room reservation home page or the at the
room reservation main menu.
Description ("Sunny Day Scenario"):
1. The user or system administrator clicks the search room availability link.
2. The user or system administrator selects a date and time. [Exception: The requested
page does not open]
3. The user or system administrator clicks the check availability button.
4. The user or system administrator views the room availability for that date and time.
[Exception: No room availability for that date and time]
Exceptions ("Rainy Day Scenario"):
The requested page does not open:
Raised when the server is unable to process the request for displaying the schedule.
The user or system administrators are alerted to the problem and are allowed to
attempt clicking the original link again.
No room availability for that date and time:
14
Online Room Reservation System
Raised when no rooms are available for the date and time selected. The user is
notified that no rooms are available, and is given the option to try a new search
(Search Room Availability use case) or browse the entire schedule for that date
(Browse Room Availability use case).
Postconditions:
The user or system administrator is able to view the room availability or they are
unable to view the requested schedule because of a problem with the server in
processing the request.
15
Online Room Reservation System
Use Case 5
Use Case Name: Login to the System
Summary:
User logs into the system
Actors:
User
Description ("Sunny Day Scenario"):
1. The user types his username and password.
2. The user clicks the login button.
3. The user is logged into the system. [Exception: Login fails]
Exceptions ("Rainy Day Scenario"):
Login fails:
Raised when the username and/or password are not valid. The user is alerted to the
problem.
Postconditions:
The user is logged into the system or denied access due to invalid login information.
16
Online Room Reservation System
Use Case 6
Use Case Name: Create a Reservation
Summary
A user reserves a room in the Client for group work. A time-based availability list for
each room is displayed for the desired date and the user chooses the time and room
best suited to him.
Actors:
User (Employees)
Pre-Conditions:
User needs to be logged into the system.
Description (“Sunny Day Scenario”):
1. From the main menu, the user clicks the „Create a Reservation‟ hyperlink. A timebased room availability table is displayed for the current date.
2. The user chooses a room for the current date or enters a date in the search field which
displays the room status for each room for the desired date.
3. Upon choosing a time and room, the user clicks the „Create Reservation‟ button,
which when clicked creates a reservation.
4. If user cannot make the reservation (s)he is looking for, (s)he can choose to receive a
notification by E-mail in case the room becomes available in the future due to
cancellation.
5. A „confirmation‟ page is displayed upon successful reservation and the use case
terminates at that point.
17
Online Room Reservation System
Post-conditions:
The user has created a reservation, has chosen to receive an availability notification
email, or has logged out of the system without any activity.
18
Online Room Reservation System
Use Case 7
Use Case Name: View All Reservations
Summary:
User views all room reservations that (s)he has made.
Actors:
User (Employees)
Pre-Conditions:
User needs to be logged into the system.
Description (“Sunny Day Scenario”):
6. On the main menu, a table showing the user‟s most recent reservations is displayed.
[Exception: No table displayed]
7. To view all reservations, (s)he clicks the „View all Reservations‟ hyperlink.
8. On a new page, a table (sorted by date) is displayed which shows all the reservations
made by the user. [Exception: No table displayed]
9. The user may navigate to the previous page and to the „Create a Reservation‟ page by
clicking links provided.
Exceptions ("Rainy Day Scenario"):
No table displayed:
Raised when the user does not have any reservations.
Post-conditions:
The user has viewed all reservations made by him/her.
19
Online Room Reservation System
Use Case 8
Use Case Name: Modify a Reservation
Summary:
User modifies one or more room reservations they have already made.
Actors:
User (Employees)
Pre-Conditions:
The user is logged into the system.
Description (“Sunny Day Scenario”):
10. From the main menu, the user clicks the „Modify a Reservation‟ hyperlink.
11. A new page is displayed where the user selects the „modify‟ radio button beside the
reservation that (s)he wishes to modify. Only one reservation can be modified at a
time. After selection of a reservation, the user clicks the „Next‟ button. [Exception:
No reservations displayed]
12. A new page is displayed wherein the user can change the time and/or date for the
chosen reservation. Two buttons, namely, “Modify” and “Delete” are displayed.
13. If the user clicks the „delete‟ button, the reservation is deleted completely after a
confirmation prompt.
14. If the user clicks the „modify‟ button, the reservation is modified if possible.
[Exception: Date and time not available]
20
Online Room Reservation System
15. Upon successful modification, a „confirmation‟ page is displayed and the use case
terminates at that point.
Exceptions: (“Rainy Day Scenario”):
No reservations displayed:
Raised when the user clicks the „modify a reservation‟ hyperlink without having any
existing reservations. An error message is displayed explaining that the user does not
have any existing reservations. Links are displayed to navigate back to the previous
page and to the „Create a Reservation‟ page.
Date and time not available:
Raised when the user enters the date and time which is not available. A message is
displayed stating that the reservation is already chosen. Links are displayed to
navigate to the previous page and to the „Create a Reservation‟ page
Post-conditions:
The user has modified the chosen reservation, deleted that reservation or has left the
reservation unchanged.
21
Online Room Reservation System
Use Case 9
Use Case Name: Delete a Reservation
Summary
User deletes one or more room reservations they have already made.
Actors:
User (Employees)
Pre-Conditions:
The user is logged into the system.
Description (“Sunny Day Scenario”):
16. From the main menu, the user clicks the „Delete a Reservation‟ hyperlink.
17. A new page is displayed where the user selects the „delete‟ radio button beside the
reservation that (s)he wishes to delete. Only one reservation can be deleted at a time.
After selecting the reservation to delete, the user clicks the „Delete‟ button provided
below the list of reservations. [Exception: No reservations displayed]
18. If the user clicks the „delete‟ button, the reservation is deleted completely after a
„confirmation‟ prompt.
19. If the user selects the „Quit without Changes‟ button, (s)he is taken back to the
„Home‟ page and no changes are saved.
20. Upon successful deletion, a „confirmation‟ page is displayed and the use case
terminates at that point.
22
Online Room Reservation System
Exceptions: (“Rainy Day Scenario”):
No reservations displayed:
Raised when the user clicks the „delete a reservation‟ hyperlink without having any
existing reservations. An error message is displayed explaining that the user does not
have any existing reservations. Links are displayed to navigate back to the previous
page and to the „Create a Reservation‟ page.
Post-conditions:
The user has successfully deleted a reservation, or has left all reservations unchanged.
23
Online Room Reservation System
Use Case 10
Use Case Name: Logout of the System
Summary:
User logs out of the system
Actors:
User
Preconditions:
The user must be logged into the room reservation system.
Description ("Sunny Day Scenario"):
1. The user clicks the logout link.
2. The user is notified that he has successfully logged out.
Postconditions:
The user is logged out of the system and is notified that he has successfully logged
out.
24
Online Room Reservation System
Use Case 11
Use Case Name: Send a Reminder Email
Summary:
The email sub-system sends a room reservation reminder email to the user at a
specific time before the actual reservation
Actors:
Email sub-system
Preconditions:
A user must have a room reservation scheduled.
Description ("Sunny Day Scenario")
1. Each night, the system searches for reservations that are scheduled for a specific time
in the future.
2. The email sub-system sends a room reservation reminder email to each user who
made one of these reservations.
Postcondition:
A room reservation reminder email has been sent to a user.
25
Online Room Reservation System
Use Case 12
Use Case Name: Create a Reservation (Administrator)
Summary
The administrator reserves a room, either for himself/herself or for someone else (i.e.
in-person or via telephone). A time-based availability list for each room is displayed
for the desired date and the administrator chooses the time and room best suited.
Actors:
Administrator
Pre-Conditions:
The administrator needs to be logged into the system.
Description (“Sunny Day Scenario”):
1. From the main menu, the administrator clicks the „Create a Reservation‟ hyperlink.
A time-based room availability table is displayed for the current date.
2. The administrator chooses a room for the current date or enters a date in the search
field which displays the room status for each room for the desired date.
3. The administrator inputs data about the individual needing the reservation.
4. The administrator clicks the „Create Reservation‟ button, which when clicked creates
a reservation.
5. If the administrator cannot make the reservation he/she is looking for, he/she can
choose to receive a notification by E-mail in case the room becomes available in the
future due to cancellation.
6. A „confirmation‟ page is displayed upon successful reservation and the use case
terminates at that point.
26
Online Room Reservation System
Post-conditions:
The administrator has created a reservation, has chosen to receive an availability
notification email, or has logged out of the system without any activity.
27
Online Room Reservation System
Use Case 13
Use Case Name: Modify a Reservation (Administrator)
Summary
The administrator wants to modify one or more currently existing room reservations
either made by him or another user.
Actors:
Administrator
Pre-Conditions:
The administrator must be logged into the system.
Description (“Sunny Day Scenario”):
7. From the main menu, the user clicks the „Modify a Reservation‟ hyperlink.
8. A new page is displayed where the administrator can enter the date and time of the
reservation he/she wants to modify. The administrator then selects the „modify‟
button. [Exception: Date and time not entered.]
9. A new page is displayed which shows the particular reservation that the administrator
has queried for. The administrator selects the „modify‟ radio button besides the
reservation that he/she wishes to modify. Only one reservation can be modified at a
time. After selection of a reservation, the administrator clicks the „Next‟ button.
10. A new page is displayed wherein the administrator can change the time and/or date
for the chosen reservation. Two buttons, namely, “Modify” and “Delete” are
displayed.
28
Online Room Reservation System
11. If the administrator clicks the „delete‟ button, the reservation is deleted completely
after a confirmation prompt.
12. If the administrator clicks the „modify‟ button, the reservation is modified if possible.
[Exception: Date and time not available]
13. Upon successful modification, a „confirmation‟ page is displayed and the use case
terminates at that point.
Exceptions: (“Rainy Day Scenario”):
Date and time not entered:
Raised when the administrator does not enter a date and time. An error message is
displayed explaining that the administrator hasn‟t entered the date and time for the
reservation he/she wishes to delete. Links are provided to navigate to the „Home‟
page and to the „Delete a Reservation‟ page.
Date and time not available:
Raised when the administrator enters the date and time which is not available. A
message is displayed stating that the reservation is already chosen. Links are
displayed to navigate to the previous page and to the „Create a Reservation‟ page
Post-conditions:
The administrator has modified the chosen reservation, deleted that reservation, or
has left the reservation unchanged.
29
Online Room Reservation System
Use Case 14
Use Case Name: Delete a Reservation (Administrator)
Summary
The administrator wants to delete one or more room reservations either made by him
or another user.
Actors:
Administrator
Pre-Conditions:
The administrator must be logged into the system.
Description (“Sunny Day Scenario”):
14. From the main menu, the administrator clicks the „Delete a Reservation‟ hyperlink.
15. A new page is displayed where the administrator can enter the date and time of the
reservation he/she wants to delete. The administrator then selects the „delete‟
checkbox button. [Exception: Date and time not entered]
16. If the administrator wishes to cancel all the reservations for a particular day, he/she
just chooses the date, and then a new page is displayed which shows all the
reservations for that particular date. The administrator then selects the “Select All”
checkbox and then clicks on the „Delete‟ button.
17. If the administrator wishes to delete only some reservations for a particular date,
he/she just enters the date and then a new page is displayed which shows all the
reservations for that particular date. The administrator then selects the particular
30
Online Room Reservation System
checkboxes for the reservation he/she wishes to delete and then clicks on the „Delete‟
button.
18. If the administrator clicks the „Delete‟ button, the reservation is deleted completely
after a „confirmation‟ prompt‟.
19. If the administrator selects the „Quit without Changes‟ button, he/she is taken back to
the „Home‟ page and no changes are made.
20. Upon successful deletion, a „confirmation‟ page is displayed and the use case
terminates at that point.
Exceptions: (“Rainy Day Scenario”):
Date and time not entered:
Raised when the administrator does not enter a date and time. An error message is
displayed explaining that the administrator hasn‟t entered the date and time for the
reservation he/she wishes to delete. Links are provided to navigate to the „Home‟
page and to the „Delete a Reservation‟ page.
Post-conditions:
The user has successfully deleted a reservation or has left all reservations unchanged.
31
Online Room Reservation System
Use Case 15
Use Case Name: Print Room Reservations
Summary
The administrator prints a particular day‟s schedule.
Actors:
Administrator
Pre-Conditions:
The administrator needs to be logged into the system.
Description (“Sunny Day Scenario”):
21. From the main menu, the administrator clicks on the Print room schedule hyperlink,
which is only available when an administrator logs on.
22. A new page is displayed which has a textbox in which the user can enter the date for
which he/she wants to print the schedule. The user then clicks the „Next‟ button.
23. A new page is displayed which shows the room reservation status for each room for
that particular date. The user then clicks the „Print‟ button.
Post-conditions:
The administrator has printed the room reservations schedule for a particular date.
32
Online Room Reservation System
Use Case 16
Use Case Name: Run Reports
Summary
The administrator runs reports about how many times a particular room has being
booked, during which semester the rooms are reserved the most etc.
Actors
Administrator
Pre-Conditions:
Administrator needs to be logged into the system.
Description (“Sunny Day Scenario”):
24. From the main menu, the administrator clicks on the Run Reports hyperlink, this is
only available when an administrator logs on.
25. A new page is displayed which has two textboxes in which the administrator can
enter the start date and the end date. [Exception: Empty or invalid date]
26. The administrator selects a particular feature from the dropdown menu and then
clicks on „Run Reports‟. The different options available in the dropdown menu are,
„Maximum Reservation‟, „Minimum Reservation‟ and „Number of Reservations‟.
[Exception: No selection made]
27. If the administrator selects „Maximum Reservation‟, a new page is displayed which
shows the room that has been booked for the maximum time for that period along
with the number of reservations for that room.
33
Online Room Reservation System
28. If the user selects „Minimum Reservation‟, a new page is displayed which shows the
room that has been booked for the minimum time for that period along with the
number of reservations for that room.
29. If the user selects „Number of Reservation‟, a new page is displayed which shows
how many times are all the rooms reserved for that particular period.
Exceptions: (“Rainy Day Scenario”):
Empty or invalid date:
Raised when the administrator enters a blank date field or date field in the future. An
error message is displayed explaining that the user hasn‟t entered the date correctly.
Links are provided to navigate to the „Home‟ page and to the „Run Reports‟ page.
No selection made:
Raised when the administrator doesn‟t select a field from the dropdown menu. An
error message is displayed explaining that the user hasn‟t selected a proper menu.
Links are provided to navigate to the „Home‟ page and to the „Run Reports‟ page.
Post-conditions:
The administrator has viewed the reports.
34
Online Room Reservation System
Testing and Error Correction
Following Tests have been conducted on the Online Room Reservation and the System has
passed all the tests
1) Unit testing
2) White box testing
3) Black box testing
Unit Testing: It is a procedure used to validate that a particular module of source code is
working properly. In this system, both the Administrator and User module have been tested
separately. Here, making a reservation, deleting a reservation, adding new user to the system
have been tested. All the features have passed the testing.
White box testing: Specifics of programming code is checked and output is examined. It
requires programming skills to identify all paths through the software. In this system all the
structural and logical code has been tested and the system passed the testing.
Black box testing: Internal code of the system is not tested but the system is tested for some
set of input and checked if desired outputs are obtained. Online Room Reservation system is
been tested for random user names and passwords, illegal dates (dates prior to current date),
incorrect input values. System could withstand for most of the test procedures, except for
illegal dates. Measures have to be taken to correct them.
35
Online Room Reservation System
Sample Screens and Reports
In this system, Administrator has the privilege to print-out a summary of all the reservations
made. Reports that are generated give a detailed list of all the reservations made and available
slots. Also, regular user can print their reservation confirmation page for their records.
(Available slots are marked as ‘Free’ and occupied slots are marked in RED)
(Creating a Reservation Page)
36
Online Room Reservation System
(Deleting a Reservation Screen)
(View Active Reservations screen)
37
Online Room Reservation System
Conclusion
Online Room Reservation System has all the capabilities to manage registrations online. This
system makes it very easy for the employees of Client to reserve collaborative work rooms
with a simple click of mouse. Problem which Client faced in maintaining registers and floor
keeps is now solved. They can now centralize the registrations by having this online
maintenance system. Administrator has the privilege to make detailed summary of room
occupancy and document them for future purposes. This system not only makes things faster
but also gives the employees flexibility to cancel and back out their reservation with a single
click.
Future Scope – A Networked World
In today‟s world if we are serious about our business we cannot afford to overlook the huge
potential that online reservation systems offer. We can have our own online reservations
system working for us 24hrs a day, 7 days a week, 365 days a year! Logic used in this system
could be applied to build many applications such as: „Online appointment system‟, „Online
time cards submission system‟, „Online bulletin board system‟ so on. As far as this system is
concerned, it could make use of video streaming to view interiors or equipments available in
the room and also this system could be enhanced by giving a „waiting list‟ feature. Whenever
a reservation is dropped the next available person in wait list can make booking for that time
slot. Like this, many more advances can be made by the current system.
38
Online Room Reservation System
References:
Sebastopol, CA : O‟Reilly, 2004 1st edition. Java servlet and JSP cookbook:
by: Bruce W. Perry
New York : McGraw-Hill/Osborne, c2003. JSP 2.0 : the complete reference:
by: Phil Hanna
Upper Saddle River, NJ : Prentice Hall, c2007 Ajax : creating Web pages with asynchronous
JavaScript and XML:
by: Edmond Woychowsky
Sebastopol, CA : O‟Reilly, 2006 1st edition Ajax design patterns:
by: Michael Mahemoff
JSP Online Tutorial: http://www.jsptut.com/
39
Online Room Reservation System
Appendix
40
Online Room Reservation System
CODE:
Login-Page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-88591">
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>Login.html</TITLE>
<LINK REL=STYLESHEET HREF="project.css" TYPE="text/css">
<script>
function validate(form){
if(form.ULID.value == ""){
alert("Please enter your EMP-ID");
form.ULID.focus();
return false;
}
if(form.password.value == ""){
alert("Please enter your password");
form.password.focus();
return false;
}
return true;
}
</script>
</HEAD>
<BODY onLoad = "document.forms[0].ULID.focus()">
<TABLE border="1" cellpadding="0" cellspacing="0" bordercolor="white">
<TBODY>
<TR bgcolor="#7b0000">
<TH colspan="5" align="left"></TH>
</TR>
<TR>
</TR>
<TR>
<TD>
<H2 align="center"><FONT color="black">Online Room
Reservation System</FONT></H2><BR>
41
Online Room Reservation System
<FONT color="black">Miracle Software Systems
provides 8 group study rooms for
Its Employees.
<FORM onSubmit="return (validate(this))"
ACTION="LoginServlet" method="post">
<TABLE border="0" width="499">
<TBODY>
<TR>
<TD width="105">EMID:</TD>
<TD width="131"><INPUT type="TEXT"
name="ULID"></TD>
<TD width="253"><FONT
color="black"><A href="NewUser.jsp">Create
an account</A></FONT></TD>
</TR>
<TR>
<TD width="105">Password:</TD>
<TD width="131"><INPUT
type="password" name="password"></TD>
<TD width="253"><FONT
color="black">Forgot your password?</FONT></TD>
</TR>
<TR>
<TD width="105"></TD>
<TD width="131"><INPUT
type="SUBMIT" value="Login"></TD>
<TD width="253"></TD>
</TR>
</TBODY>
</TABLE>
<p align="center"><BR>
<FONT
color="black"></FONT> <BR>
<BR></p></FORM>
</TD>
</TR>
</TBODY>
</TABLE>
</BODY>
</HTML>
Main Menu:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
42
Online Room Reservation System
<META http-equiv="Content-Type" content="text/html; charset=ISO-88591">
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>MainMenu.jsp</TITLE>
<LINK REL=STYLESHEET HREF="project.css" TYPE="text/css">
</HEAD>
<BODY>
<%@ page import="newuser.*, javax.servlet.*" %>
<%@ page import="java.sql.*" %>
<%@ page import="java.util.*" %>
<%
//Returns the object bound with the specified name in this session, or
null if no object is bound under the name.
User user = (User) session.getAttribute("user");
if (null == user) {
//request.setAttribute("Error", "Session has ended. Please
login.");
RequestDispatcher rd =
request.getRequestDispatcher("Login.html");
rd.forward(request, response);
}
%>
<TABLE border="1" cellpadding="0" cellspacing="0" bordercolor="white">
<TBODY>
<TABLE border="0" width="503">
<TBODY>
<TR>
<TD width="34%"><FONT
color="black">Welcome <%= user.getFirstName() %>!</FONT></TD>
<TD width="33%"></TD>
<TD width="33%" align="right"><FONT
color="black"><A href="LoggedOut.jsp">Logout</A></FONT></TD>
</TR>
</tbody></table>
<table>
<tr>
<td>
<%
String URL="jdbc:odbc:DatabaseDB";
Connection conn;
Statement stmt;
String
mode_check=request.getParameter("mode");
if (mode_check==null)
{
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
43
Online Room Reservation System
conn=DriverManager.getConnection(URL,"","");
stmt=conn.createStatement();
String ulid =
user.getUlid();
//get ULID from session object
//get current date
GregorianCalendar now =
new GregorianCalendar();
int month =
now.get(GregorianCalendar.MONTH) + 1;
int day =
now.get(GregorianCalendar.DAY_OF_MONTH);
int year =
now.get(GregorianCalendar.YEAR);
String curDate = month+
"/" +day+ "/" +year;
//System.out.println("Current Date: " +curDate);
String
reservationQuery="SELECT ResDate, StartTime, EndTime, RoomID FROM
Reservation WHERE ULID = '"
+ ulid + "' AND
ResDate >= #" +curDate+ "# ORDER BY ResDate, StartTime";
ResultSet
rs=stmt.executeQuery(reservationQuery);
%>
<FONT
color="black"><B>Upcoming Reservations:</B> </FONT>
<table border="1">
<TBODY>
<tr><td></td>
<td><FONT color="black">Date</FONT></td>
<td><FONT color="black">Start Time</FONT></td>
<td><FONT color="black">End Time</FONT></td>
<td><FONT color="black">Room Number</FONT></td>
</tr>
<%
int i
= 0;
while
(rs.next() && i < 3)
{
i++; %>
<tr><td><%= i %>.</td>
<td><%=rs.getDate("ResDate") %></td>
44
Online Room Reservation System
<td><%=rs.getTime("StartTime") %></td>
<td><%=rs.getTime("EndTime") %></td>
<td><%=rs.getString("RoomID") %></td>
</tr>
<%}
if(i
== 0){%>
<tr><td colspan=5><FONT color="black">None</FONT></td></tr>
<% }
%>
</tbody></table>
<%
}
catch(SQLException se)
{
System.err.println(se.getMessage());
System.out.println("SQL problem");
}
catch(ClassNotFoundException cnfe)
{
System.err.println(cnfe.getMessage());
System.out.println("Class not found");
}
catch(Exception e)
{
System.err.println(e.getMessage());
}
}
%>
</td>
</tr></table><TABLE border="0"
width="240">
<TBODY>
<TR>
<TD width="30"></TD>
<TD width="206"><FONT
color="black"><A href="Browse.jsp">Browse
Room Availability</A></FONT></TD>
</TR>
<TR>
<TD width="30"></TD>
<TD width="206"><FONT
color="black"><A href="SearchTry.jsp">Search
Room Availability</A></FONT></TD>
</TR>
45
Online Room Reservation System
<TR>
<TD width="30"></TD>
<TD width="206"><FONT
color="black"><A
href="CreateReservation.jsp">Create a Reservation</A></FONT></TD>
</TR>
<TR>
<TD width="30"></TD>
<TD width="206"><FONT
color="black"><A href="deletereservations1.jsp">Delete a
Reservation</A></FONT></TD>
</TR>
<TR>
<TD width="30"></TD>
<TD width="206"><FONT
color="black"><A href="ViewActiveReservations.jsp">View Active
Reservations</A></FONT></TD>
</TR>
<TR>
<TD width="30"></TD>
<TD width="206"><FONT
color="black"><A href="ChangeUserInfo.jsp">Change
User Information</A></FONT></TD>
</TR>
<TR>
<TD width="30"></TD>
<TD width="206"></TD>
</TR>
</TBODY>
</TABLE></TD>
</TR>
<TR>
<TD width="20%" bgcolor="#c6c3a5"
height="150"></TD></TR>
</TBODY>
</TABLE>
</BODY>
</HTML>
Creating New Reservation
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-88591">
46
Online Room Reservation System
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>CreateReservation.jsp</TITLE>
<LINK REL=STYLESHEET HREF="project.css" TYPE="text/css">
<script language="JavaScript" src="DatePicker.js"></script>
<script>
function validate(form){
//Check that date is not empty
if(form.datebox.value.length == 0){
alert("Please enter a date.");
return(false);
}
//Check that start time is not empty
if(form.startTime.value == "select"){
alert("Please enter a start time.");
return(false);
}
//Check that end time is not empty
if(form.endTime.value == "select"){
alert("Please enter an end time.");
return(false);
}
//Check that room is not empty
if(form.room.value == "select"){
alert("Please enter a room.");
return(false);
}
//Check that start time is before end time
sLength = form.startTime.value.length;
startLabel = form.startTime.value.substring(sLength-2, sLength);
startTimeInt = parseInt(form.startTime.value); //parse String to
Int
eLength = form.endTime.value.length;
endLabel = form.endTime.value.substring(eLength-2, eLength);
endTimeInt = parseInt(form.endTime.value); //parse String to Int
if(startLabel == "PM" && endLabel == "AM"){
alert("The start time must be before the end time.");
return(false);
}
if(startLabel == endLabel && endTimeInt < startTimeInt){
alert("The start time must be before the end time.");
return(false);
}
return(true);
}
function setAll()
{
var k;
var m="AM";
47
Online Room Reservation System
var s1=document.calform.sTime.value;
if (s1>12)
{
k=s1-12;
m="PM";
}
else
{
k=s1;
}
var s=k+":00 "+m;
var r=document.calform.roomid.value;
var d=document.calform.date.value;
document.calform.datebox.value=d;
//alert("start time "+s);
for(var i=0;i<document.calform.startTime.length;i++)
{
if (document.calform.startTime[i].value==s)
{
document.calform.startTime.selectedIndex=i;
break;
}
}
for(var j=0;j<document.calform.room.length;j++)
{
if (document.calform.room[j].value==r)
{
document.calform.room.selectedIndex=j;
break;
}
}
}
</script>
</HEAD>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<%
String sTime=request.getParameter("stime");
String resDate=request.getParameter("date");
if (resDate==null)
{
resDate="";
}
String roomId=request.getParameter("roomid");
System.out.println(resDate);
%>
<BODY onLoad='setAll()'>
<%@page import="newuser.*"%>
<% User user = (User) session.getAttribute("user");
if (null == user) {
//request.setAttribute("Error", "Session has ended.
login.");
RequestDispatcher rd =
request.getRequestDispatcher("Login.html");
rd.forward(request, response);
}
%>
48
Please
Online Room Reservation System
<TABLE border="1" cellpadding="0" cellspacing="0" bordercolor="white">
<TBODY>
<TR bgcolor="#7b0000">
<TH colspan="5" width="568" align="left"></TH>
</TR>
<TR>
</TR>
<TR>
<TD width="20%" colspan="4" rowspan="11" align="left"
valign="top" bgcolor="white">
<TABLE border="1" cellpadding="0" cellspacing="0"
bgcolor="#e2e6e7"
bordercolor="white">
<TBODY>
<TR>
<TD align="center"
width="13%"><FONT color="black"><A
href="Browse.jsp">Browse
Rooms</A></FONT></TD>
<TD align="center"
width="12%"><FONT color="black"><A
href="SearchTry.jsp">Search
Rooms</A></FONT></TD>
<TD align="center" width="87"><FONT
color="black"><A
href="CreateReservation.jsp">Create Reservation</A></FONT></TD>
<TD align="center" width="92"><FONT
color="black">Modify Reservation</FONT></TD>
<TD align="center" width="93"><FONT
color="black"><A
href="deletereservations1.jsp">Delete Reservation</A></FONT></TD>
<TD align="center" width="95"><FONT
color="black"><A
href="ViewActiveReservations.jsp">View
Reservations</A></FONT></TD>
</TR>
</TBODY>
</TABLE>
<BR>
<TABLE border="0">
<TBODY>
<TR>
<TD width="197"><FONT
color="#008080"><FONT color="#008080"><FONT
color="black"><B><SPAN
style="background-color: #FFFFFF">Create
Reservation
Page</SPAN></B></FONT></FONT></FONT></TD>
<TD width="170"><FONT
color="#008080"><FONT color="#008080"><U><B><SPAN
49
Online Room Reservation System
style="background-color:
#FFFFFF"></SPAN></B></U></FONT></FONT></TD>
<TD width="76"><%
if(user.isAdmin()){ %> <A
href="MainMenuAdmin.jsp">Main
Menu </A> <% }
else { %> <A href="MainMenu.jsp">Main Menu </A> <%
} %></TD>
<TD width="48"><A
href="LoggedOut.jsp">Logout</A></TD>
</TR>
</TBODY>
</TABLE>
<form name=calform onSubmit="return (validate(this))"
method="post" action="CreateReservationServlet"><FONT color="black">
Date: <INPUT type="text"
name="datebox" size="15" value="<%=resDate
%>"><A
href="javascript:show_calendar('calform.datebox');"
onmouseover="window.status='Date Picker';return
true;"
onmouseout="window.status='';return true;"><IMG
src="pic.jpeg" width="24" height="22"
border="0"></A> <BR>
<input type=hidden name=sTime
value='<%=sTime%>'>
<input type=hidden name=date value='<%=resDate%>'>
Start Time: <SELECT name="startTime">
<OPTION value="select" selected>Select</OPTION>
<OPTION value="8:00 AM">8:00 AM</OPTION>
<OPTION value="9:00 AM">9:00 AM</OPTION>
<OPTION value="10:00 AM">10:00 AM</OPTION>
<OPTION value="11:00 AM">11:00 AM</OPTION>
<OPTION value="12:00 PM">12:00 PM</OPTION>
<OPTION value="1:00 PM">1:00 PM</OPTION>
<OPTION value="2:00 PM">2:00 PM</OPTION>
<OPTION value="3:00 PM">3:00 PM</OPTION>
<OPTION value="4:00 PM">4:00 PM</OPTION>
<OPTION value="5:00 PM">5:00 PM</OPTION>
<OPTION value="6:00 PM">6:00 PM</OPTION>
<OPTION value="7:00 PM">7:00 PM</OPTION>
<OPTION value="8:00 PM">8:00 PM</OPTION>
<OPTION value="9:00 PM">9:00 PM</OPTION>
<OPTION value="10:00 PM">10:00 PM</OPTION>
<OPTION value="11:00 PM">11:00 PM</OPTION>
</SELECT><BR>
End Time: <SELECT name="endTime">
<OPTION value="select" selected>Select</OPTION>
<OPTION value="8:59 AM">8:59 AM</OPTION>
<OPTION value="9:59 AM">9:59 AM</OPTION>
<OPTION value="10:59 AM">10:59 AM</OPTION>
<OPTION value="11:59 AM">11:59 AM</OPTION>
<OPTION value="12:59 PM">12:59 PM</OPTION>
<OPTION value="1:59 PM">1:59 PM</OPTION>
<OPTION value="2:59 PM">2:59 PM</OPTION>
50
Online Room Reservation System
<OPTION value="3:59 PM">3:59 PM</OPTION>
<OPTION value="4:59 PM">4:59 PM</OPTION>
<OPTION value="5:59 PM">5:59 PM</OPTION>
<OPTION value="6:59 PM">6:59 PM</OPTION>
<OPTION value="7:59 PM">7:59 PM</OPTION>
<OPTION value="8:59 PM">8:59 PM</OPTION>
<OPTION value="9:59 PM">9:59 PM</OPTION>
<OPTION value="10:59 PM">10:59 PM</OPTION>
<OPTION value="11:59 PM">11:59 PM</OPTION>
</SELECT><BR>
Room Number:</FONT>
<input type=hidden name=roomid value='<%=roomId%>'>
<SELECT name="room">
<OPTION value="select" selected>Select</OPTION>
<%
String URL="jdbc:odbc:DatabaseDB";
Connection conn;
Statement stmt;
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection(URL,"","");
stmt=conn.createStatement();
String roomQuery="SELECT RoomID, RoomName
FROM Room";
ResultSet
rs=stmt.executeQuery(roomQuery);
while(rs.next()) {
int rmNum = rs.getInt("RoomID");
String rmName =
rs.getString("RoomName");
%>
<OPTION value=<%= rmNum %>><%= rmName
%></OPTION>
<%
}
}
catch(SQLException se)
{
System.err.println(se.getMessage());
System.out.println("SQL problem");
}
catch(ClassNotFoundException cnfe)
{
System.err.println(cnfe.getMessage());
System.out.println("Class not found");
}
catch(Exception e)
51
Online Room Reservation System
{
System.err.println(e.getMessage());
} %>
</SELECT><BR>
<BR>
<INPUT type="submit" name="create" value="Create">
<INPUT type="reset" value="Reset"></form>
</TD>
</TR>
<TR>
</TR>
</TBODY>
</TABLE>
</BODY>
</HTML>
Search Page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-88591">
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>Search for Reservations</TITLE>
<LINK REL=STYLESHEET HREF="project.css" TYPE="text/css">
<script language="JavaScript" src="DatePicker.js"></script>
<script language=javascript>
function validateAll()
{
var check1=false;
var check2=false;
for (var i=0;i<=document.search.starttime.length-1;i++)
{
if (document.search.starttime[i].selected)
{
check1=true;
}
}
for (var j=0;j<=document.search.timeperiod.length-1;j++)
{
if (document.search.timeperiod[j].selectedIndex!=-1)
{
check2=true;
}
}
if (check1==false)
52
Online Room Reservation System
{
alert("select a start time! ");
return false;
}
if (document.search.txtdate.value=="")
{
alert("enter a date");
return false;
}
if (check2==false)
{
alert("select a time period! ");
return false;
}
else
{
return true;
}
}
</script>
</HEAD>
<BODY>
<%@page import="newuser.*"%>
<% User user = (User) session.getAttribute("user"); %>
<TABLE border="1" cellpadding="0" cellspacing="0" bordercolor="white">
<TBODY>
<TR bgcolor="#7b0000">
</TR>
<TR>
</TR>
<TR>
<TD colspan="4" rowspan="11" align="left"
valign="top"
bgcolor="white">
<TABLE border="1" cellpadding="0" cellspacing="0"
bgcolor="#e2e6e7"
bordercolor="white">
<TBODY>
<TR>
<TD align="center"
width="13%"><FONT color="black"><A
href="Browse.jsp">Browse
Rooms</A></FONT></TD>
<TD align="center"
width="12%"><FONT color="black"><A
href="SearchTry.jsp">Search
Rooms</A></FONT></TD>
<TD align="center" width="87"><FONT
color="black"><A
href="CreateReservation.jsp">Create Reservation</A></FONT></TD>
<TD align="center" width="92"><FONT
color="black">Modify Reservation</FONT></TD>
53
Online Room Reservation System
<TD align="center" width="93"><FONT
color="black"><A
href="deletereservations1.jsp">Delete Reservation</A></FONT></TD>
<TD align="center" width="95"><FONT
color="black"><A
href="ViewActiveReservations.jsp">View
Reservations</A></FONT></TD>
</TR>
</TBODY>
</TABLE>
<TABLE border="0">
<TBODY>
<TR>
<TD width="197"><FONT
color="#008080"><FONT color="#008080"><FONT
color="black"><B><SPAN
style="background-color: #FFFFFF">Search Rooms
Page</SPAN></B></FONT></FONT></FONT></TD>
<TD width="170"><FONT
color="#008080"><FONT color="#008080"><U><B><SPAN
style="background-color:
#FFFFFF"></SPAN></B></U></FONT></FONT></TD>
<TD width="76"><%
if(user.isAdmin()){ %> <A
href="MainMenuAdmin.jsp">Main
Menu </A> <% }
else { %> <A href="MainMenu.jsp">Main Menu </A> <%
} %></TD>
<TD width="48"><A
href="LoggedOut.jsp">Logout</A></TD>
</TR>
</TBODY>
</TABLE>
<p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;</p>
<form name=search method="POST"
action=SearchDisplay.jsp onsubmit="return validateAll()" >
<table border="0" width="100%" id="table1">
<tr>
<td width="385">Enter
Date:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="text" name="txtdate"
size="20">
54
Online Room Reservation System
<A
href="javascript:show_calendar('search.datebox');"
onmouseover="window.status='Date Picker';return
true;"
onmouseout="window.status='';return true;"><IMG
src="show-calendar.gif" width="24" height="22"
border="0"></A>
</td>
<td width="230"><input type="radio"
value="am" name=timeperiod>&nbsp;
AM Only</td>
</tr>
<tr>
<td width="385">Enter Start
Time:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<SELECT name="starttime">
<OPTION value="Select Time"
selected>Select</OPTION>
<OPTION value="8">8:00 AM</OPTION>
<OPTION value="9">9:00 AM</OPTION>
<OPTION value="10">10:00
AM</OPTION>
<OPTION value="11">11:00
AM</OPTION>
<OPTION value="12">12:00
PM</OPTION>
<OPTION value="13">1:00 PM</OPTION>
<OPTION value="14">2:00 PM</OPTION>
<OPTION value="15">3:00 PM</OPTION>
<OPTION value="16">4:00 PM</OPTION>
<OPTION value="17">5:00 PM</OPTION>
<OPTION value="18">6:00 PM</OPTION>
<OPTION value="19">7:00 PM</OPTION>
<OPTION value="20">8:00 PM</OPTION>
<OPTION value="21">9:00 PM</OPTION>
<OPTION value="22">10:00
PM</OPTION>
<OPTION value="23">11:00
PM</OPTION>
</SELECT></td>
<td width="230"><input type="radio"
name=timeperiod value=pm>&nbsp; PM
Only</td>
</tr>
<tr>
<td width="385" height="25"><input
type="submit" value="Submit"
name="B1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="reset"
value="Reset"
name="B2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href=SearchMore.jsp>more
features</a></td><TD><INPUT
55
Online Room Reservation System
type="radio" name="timeperiod"
value="all">&nbsp;&nbsp;All Day</td>
<td>&nbsp; </td>
</tr>
</table>
</form>
</TD>
</TR>
<TR>
</TR>
</TBODY>
</TABLE>
</BODY>
</HTML>
Browse Reservation Page
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-88591">
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet" type="text/css">
<TITLE>Browse for Reservations</TITLE>
<LINK REL=STYLESHEET HREF="project.css" TYPE="text/css">
<SCRIPT language=javascript>
function setModifyInc()
{
document.browse.modified.value="1";
alert("next "+document.browse.modified.value);
}
function setModifyDec()
{
document.browse.modified.value="-1";
alert("previous"+document.browse.modified.value);
}
</SCRIPT>
</HEAD>
<BODY>
<%@page import="reservation.*" %>
<%@page import="newuser.*" %>
<% User user = (User) session.getAttribute("user");
if (user==null)
{
try
{
response.sendRedirect("Login.html");
56
Online Room Reservation System
}
catch(Exception e)
{
System.err.println(e.getMessage());
}
}
%>
<TABLE border="1" cellpadding="0" cellspacing="0" bordercolor="white"
width="100%">
<TBODY>
<TR bgcolor="#7b0000">
</TH>
</TR>
<TR>
</TR>
<TR>
<TD width="135" height="21" bgcolor="#c6c3a5"></TD>
<TD colspan="4" rowspan="11" align="left"
valign="top"
bgcolor="white"><%@page
import="reservation.*"%> <%@page
import="java.sql.*"%> <%@page
import="newuser.*"%>
<%@page import="java.util.*" %><TABLE
border="1" cellpadding="0" cellspacing="0" bgcolor="#e2e6e7"
bordercolor="white">
<TBODY>
<TR>
<TD align="center"
width="13%"><FONT color="black"><A
href="Browse.jsp">Browse
Rooms</A></FONT></TD>
<TD align="center"
width="12%"><FONT color="black"><A
href="SearchTry.jsp">Search
Rooms</A></FONT></TD>
<TD align="center" width="87"><FONT
color="black"><A
href="CreateReservation.jsp">Create Reservation</A></FONT></TD>
<TD align="center" width="92"><FONT
color="black">Modify Reservation</FONT></TD>
<TD align="center" width="93"><FONT
color="black"><A
href="deletereservations1.jsp">Delete Reservation</A></FONT></TD>
<TD align="center" width="95"><FONT
color="black"><A
href="ViewActiveReservations.jsp">View
Reservations</A></FONT></TD>
</TR>
</TBODY>
</TABLE>
<BR>
57
Online Room Reservation System
<TABLE border="0">
<TBODY>
<TR>
<TD width="197"><FONT
color="#008080"><FONT color="#008080"><FONT
color="black"><B><SPAN
style="background-color: #FFFFFF">Browse
Room
Page</SPAN></B></FONT></FONT></FONT></TD>
<TD width="170"><FONT
color="#008080"><FONT color="#008080"><U><B><SPAN
style="background-color:
#FFFFFF"></SPAN></B></U></FONT></FONT></TD>
<TD width="76">
<% if(user.isAdmin()){ %>
<a href="MainMenuAdmin.jsp">Main Menu </a>
<% }
else { %>
<a href="MainMenu.jsp">Main Menu </a>
<% } %>
</TD>
<TD width="48"><A
href="LoggedOut.jsp">Logout</A></TD>
</TR>
</TBODY>
</TABLE>
<FORM name=browse method=post action=Browse.jsp>
<%
String resDate="";
if (user == null) {
try {
response.sendRedirect("Login.html");
} catch (Exception e) {
System.err.println(e.getMessage());
}
} else {
int incr;
String change=request.getParameter("modified");
String allNewDate=request.getParameter("ndate");
System.out.println("value is "+change);
int days=0,month=0,year=0;
if (change==null)
{
incr=0;
GregorianCalendar now=new GregorianCalendar();
//now.add(GregorianCalendar.DAY_OF_MONTH,incr);
days=now.get(GregorianCalendar.DAY_OF_MONTH);
month=now.get(GregorianCalendar.MONTH)+1;
year=now.get(GregorianCalendar.YEAR);
GregorianCalendar now1=new
GregorianCalendar(year,month,days);
resDate=month+"/"+days+"/"+year;
System.out.println("Date for 1st is "+resDate);
}
58
Online Room Reservation System
else
{
incr=Integer.parseInt(change);
String arrayDate[]=allNewDate.split("/");
int intArrayDate[]=new int[arrayDate.length];
for (int i=0;i<=arrayDate.length-1;i++)
{
intArrayDate[i]=Integer.parseInt(arrayDate[i]);
System.out.println(intArrayDate[i]);
}
GregorianCalendar nowInside=new
GregorianCalendar(intArrayDate[2],intArrayDate[0]-1,intArrayDate[1]);
System.out.println("the increase "+incr);
nowInside.add(GregorianCalendar.DAY_OF_MONTH,incr);
month=nowInside.get(GregorianCalendar.MONTH)+1;
days=nowInside.get(GregorianCalendar.DAY_OF_MONTH);
year=nowInside.get(GregorianCalendar.YEAR);
System.out.println(days);
//GregorianCalendar now1=new
GregorianCalendar(year,month,days);
resDate=month+"/"+days+"/"+year;
System.out.println("For other dates "+resDate);
}
%>
<TABLE border=1>
<tr>
<i><B>Date: <%=resDate%></B></i>
</tr>
<TR>
<TD>Time</TD>
<%
String[] room=null;
room=ReservationDB.getAllRooms();
for (int m=0;m<room.length;m++)
{%>
<td><b>Room <%=room[m] %><b></td>
<%} %></TR>
<TR>
<TD>8 AM - 9 AM</TD>
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("8",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
59
Online Room Reservation System
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=8&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=8&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<TR>
<TD>9 AM - 10 AM</TD>
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("9",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=9&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=9&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<TR>
<TD>10 AM - 11 AM</TD>
60
Online Room Reservation System
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("10",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=10&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=10&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<TR>
<TD>11 AM - 12 PM</TD>
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("11",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=11&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
61
Online Room Reservation System
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=11&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<TR>
<TD>12 PM - 1PM</TD>
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("12",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=12&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=12&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<TR>
<TD>1 PM - 2 PM</TD>
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("13",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
62
Online Room Reservation System
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=13&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=13&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<TR>
<TD>2 PM - 3 PM</TD>
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("14",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=14&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
63
Online Room Reservation System
<td><a
href='CreateReservation.jsp?stime=14&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<TR>
<TD>3 PM - 4 PM</TD>
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("15",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=15&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=15&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<TR>
<TD>4 PM - 5 PM</TD>
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("16",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
64
Online Room Reservation System
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=16&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=16&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<TR>
<TD>5 PM - 6 PM</TD>
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("17",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=17&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=17&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
65
Online Room Reservation System
}%>
</TR>
<TR>
<TD>6 PM - 7 PM</TD>
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("18",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=18&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=18&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<TR>
<TD>7 PM - 8 PM</TD>
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("19",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
66
Online Room Reservation System
<td><a
href='CreateReservation.jsp?stime=19&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=19&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<TR>
<TD>8 PM - 9 PM</TD>
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("20",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=20&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=20&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<TR>
<TD>9 PM - 10 PM</TD>
<%for(int m=0;m<room.length;m++){
67
Online Room Reservation System
try {
String roomNum[] =
ReservationDB.browseAllRooms("21",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=21&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=21&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<TR>
<TD>10 PM - 11 PM</TD>
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("22",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=22&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
68
Online Room Reservation System
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=22&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<TR>
<TD>11 PM - 12 AM</TD>
<%for(int m=0;m<room.length;m++){
try {
String roomNum[] =
ReservationDB.browseAllRooms("23",resDate);
boolean check = false;
for (int j = 0; j <= roomNum.length - 1; j++) {
if (roomNum[j].equals(room[m])) {
check = true;
break;
} else {
check = false;
}
}
if (check == true) {%>
<td>-----</td>
<%} else {%>
<td><a
href='CreateReservation.jsp?stime=23&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%}
} catch (ClassNotFoundException cnfe) {
System.err.println(cnfe.getMessage());
} catch (SQLException se) {
System.err.println(se.getMessage());
} catch (NullPointerException npe) {%>
<td><a
href='CreateReservation.jsp?stime=23&roomid=<%=room[m]
%>&date=<%=resDate%>'>Free</a></td>
<%
npe.printStackTrace();
}
}%>
</TR>
<%} %>
</TABLE>
<a href=Browse.jsp?modified=-1&ndate=<%=resDate %>>Previous</a>&nbsp;
<a href=Browse.jsp?modified=1&ndate=<%=resDate %>>Next</a>
</form>
</TD>
</TR>
</TBODY>
</TABLE>
69
Online Room Reservation System
</BODY>
</HTML>
70