I mean that, I can directly specify a javascript function call to a html tag inside Tag file
such as
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:
--OR--
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.