Hi , I am using servlet and JSP in my application. Problem is that :- when a user try to login through login.jsp then this request goes to LoginAction servlet, where DB connection is done . In this (LoginAction)server if user is not Authentic then it will through an "Invalid Login Attempt By user <userName>". I want to display this error message on login.jsp. plz help me in solving this problem.
Thanx in advance..
Joined: Sep 11, 2005
Before redirecting to the JSP from LoginAction Servlet, set the userName in Session and authentication status in reuest as attributes and forward to JSP.
In JSP, You can check if the user is authenticated from the request attribute and display the message accordingly. The userName can alsways be retrieved from the Session.
Hi Sravan , Thanx for your reply. One thing is that I am already checking user Authentication in servlet then why I have to again check it in jsp. I want to print(on login.jsp) that mesaage which is thrown by an InvalidLoginException class(in LoginAction servlet). can I use a concept of errorpage.jsp. Plz help me with example. Thanx