I am working on demo application for learning purpose. Need some help below. My requirement is to use SERVLET/JSP for this. Values are hard coded just for demo purpose.
Question: Manage Page State after Server Side Validation
Manage Page State?
Form submitted and doPost called on
Servlet. In case of error need to post submitted values back to posted to refill form values.
Got 2 options: please look at my servlet doPost
Should I use session
Should I use user object --> I have used this
Am I doing it right or is there any better approach?
Question 2 Important
I arrive at UserEdit.jsp page from UserList.jsp page which uses URL
Pattern like /user/edit than my URL in browser is
http://localhost:8080/Navigation/user/edit?id=10. I pass id for demo purpose right now.
Problem: In case of form input error when I use
than my URL is changed and becomes
http://localhost:8080/Navigation/user/edit.
How can I keep my same URL with id paramter like ?id=10 in URL. I have tried alot but solution found yet. See my Servlet.
User Class
One SERVLET for CRUD operation
2 pages in /WEB-INF/admin
UserList.jsp
UserEdit.jsp