Joined: Mar 12, 2010
At first, I decided to accept login input from HTML controls and then it will send the data to the LoginServlet which will checks the database and logs in the user and redirect to its homepage view.
But now, I'm thinking to make login tag file.
But should I include a submit button inside the tag file or I should keep use it outside.
And specify the validate function in JSP page which uses the tag, since the output of tag file is going to merge into jsp page, it will work. But I don't think its right thing to do.
Should I code it like this:
I'm still confused with the displaying of ajax content. If I use Login tag in index.jsp, I want when user clicks on submit, it will go to LoginServlet. If user is not existing in database, it will redirect it to index.jsp(since I cannot redirect it to tag) passing errorMessage in Query String. Now how will I show this message in my tag, since tag is already rendered by JSP.
Only way I see to do this is to call LoginServlet and it will then forward the errorMessage to another JSP page called ErrorPage and it will just display the errorMessage recieved. Now when the response is sent, it contains this errorMessage and ajax will reflect it to the desired location. So, I'll have to make a seperate JSP page just to display a message :shock:
(I know the concept of error pages, but they are used to display a user friendly error message if any exception occurs in our JSP. I'm using it to build an ajax response). Am I on the right track or not.