I have created a login html page which executes my login servlet which connects my mysql database and if username & password are correct returns the name and address of the user from the database through in html format.
I have a few questions
1. how do i create an error page? so if the account doesnt exist etc it returns an error page
2. How do i make it create a session and a new cookie once its logged in the user?
1. There are several ways. Best case is to show an userfriendly message somewhere in the form, in the top, or next to input field, or below the button, etc.
2. The webcontainer already does that for you. General approach is to put the User object as attribute in HttpSession so that your application can intercept on that. If session.getAttribute("user") returns null, then the user is not logged in.