I’ve got a page to remove vehicle with a specific registration number from the fleet:
Step 1 – page.jsp – page to enter vehicle registration number and search button
Step 2 – a servlet finds the car by a reg. number from the database then i wont to show all the vehicle details (model, type) and ask if the user is sure this is a right vehicle to remove.
Step 3 – so I’m redirecting user to another page with all the vehicle details and two buttons (go back, remove).
Question 1
When i enter my reg. number on the first page i can get it as request.getAttribute(reg_number) in the servlet, but can i get it from the confirmation page?
Question 2
Is it a right way to do a confimation considering i can only use jsp and servlets?
I can’t use javascript
Thanks for considering my question
A very common way of handling this is to pass the identifier, the registration number in this case, back to the page on step three. Since you’re redirecting, you would simply pass the registration number as a request parameter.
Your confirmation page with the “remove” button would be a form (since it should use POST for these semantics) that could have a hidden parameter of the registration number that was given to the page as a request parameter.
You might have this form on the page in step three: (E.g.,
http://fleetmanager.com/fm/remove?regNumber=AHH8777AHGZZZTSG8747)Using the
Sessioncould cause problems, including the removal of the wrong vehicle from the fleet if the user happened to be using two two tabs in the browser to remove and search for vehicles. I would not use theSessionfor this.