Coding
Coding
Watch this video to get insight on servlet, jsp, jbdc and maven
1. Admins
- Login – the admin can be able to login using email and password
- Logout – admin can logout
- Admin can get dashboard reports
- User cannot access any admin resources until they login
Tasks
- Create a login.jsp page and design the form’s action to point to “login” url
- Create a showLoginForm method in the AdminsController class that is responsible for
presenting the user with the login form whenever a GET request Is sent via /login
- Create another method called login in the same class that will handle the form parameters
when sent via POST request, which will intern call the responsible Admin model and
pass the data to AdminDAO class and respond with appropriate data --- that means that
AdminDAO will have a method to check if email or password exists and if they match.
- Make sure to check If user exists and respond with appropriate error messages “Wrong
login credentials” can be good for user does not exists or if password does not match the
email.
- NOTE: the admin can be manually created in the DB, you don’t need to handle the create
- NOTE: prevent user from accessing any admin resource like driver, booking etc when
they haven’t logged in, meaning If I were to type the url directly it should redirect me to
login page.
- Also make the login page be the first page a user sees when they access /admin url
- When login is successful redirect the user to dashboard page
- In dashboard page, using the /admin url, in AdminController class, fetch the fields and
present them e.g total amount should be summation of all amounts field in the bookings
table, alias with people working in booking to present that function to you and drivers
and parking area
Videos that can help with login
Login using Servlet and JSP practical Part 1 - YouTube
Login using Servlet and JSP | How to Prevent Back button after Logout? | Part 2 - YouTube
Login using Servlet and JSP | JDBC | Part 3 - YouTube
2. Parking slots
- Creation of parking slots whenever admin adds a new parking_area
- Update parking slots when parking area is edited
- Prevent editing whenever a booking of a parkin slot has occurred
- Delete parking slots whenever a parking area is deleted
- Change the status of parking slot based on booking status change
- Get all parking slots that belong to a parking area
Tasks
- Parking slots are supposed to be created based on the capacity of the parking area, that
means if a parking area has 20 slots, all those slots will be created with the appropriate
details like number (you can randomly generate this, mix strings and numbers). So, write
a method that can create slots based on capacity, this method will be called by the team
responsible for creating parking area.
- This may seem inefficient but whenever the admin edits the parking area, they may
change the capacity of the parking area (probably due to a mistake during creation), write
a method that can handle that, this may force you to delete all parking slots for that
parking area and then call the function to create parking slots again or find the difference
in original capacity and the new capacity and either delete or add based on whether it’s
negative or positive.
- NOTE: make sure to check if parking slot has been booked (any parking slot) then
prevent editing. No editing if booking has occurred – alias with parking area guys to
handle this, because they will use this function
- Write a method to delete all parking slots of a specific parking area
- Write a method to change status of parking slot, this will be used whenever someone
books or whenever the admin checks them out
3. Vehicles
- User(driver) can add a new vehicle
- Can get vehicles that belong to them
Tasks
- Create a method to add vehicle to db in VehicleController, make sure to create
VehicleDAO and VehicleModel as well.
- Create another method to get all vehicles based on driverId
4. Drivers
- Create a new driver
- Search driver based on driving license
- Get all drivers, along with their vehicles
- Create method to get number of drivers available
Tasks
- Create a method in DriverDAO to create a new driver,
- Another method to search for a driver using a driving license, and then create a
corresponding method in DriversController to respond to the search from the request
param.
- Create another method in DriverDAO to get all drivers inluding their vehicles and
another corresponding method in DriversController to handle that, make sure to update
the driver admin UI
- Create a method to get count of drivers available (this will be consumed by the guys
working on admin)
5. Bookings
- Driver can book a parking spot
- Admin can get all booking report
- Admin can mark booking as complete and viceverse
- Method to get all booking amount and orders count (for admin)
Tasks
- Create BookingDAO, Booking model and controller with appropriate reports
- Create methods to handle booking in the controller and DAO and respond with successful
or error
- Handle the client views for booking
- Create a method to get all bookings and present them in booking table in admin
- Create methods to get booking count and amount for admin (DAO)
- Create method to change booking status
6. Parking Area
- Add, edit, delete parking area
- Get all parking areas
- Get a parking area based on id along all parking slots (from parking slot guys)
Tasks
- Create DAO, controller and model for the CRUD processes
- Handle the requests in controller and respond appropriately
- Handle requests and responses in the UI’s as well