Login - revisited
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   David_Pizon
Posted On:   Sunday, October 3, 2004 10:54 PM

I am a Struts newbie attempting to write a login app. Most (if not all) of the examples I have found online use three JSP pages: login.jsp (prompts user for username/password, re-displays if invalid) fail.jsp (username/password valid but incorrect) success.jsp (username/password was correct) I would like to change my app to have use only two JSP pages: login.jsp (prompts user for username/password, re-displays if invalid, re-displays if incorrect) success.jsp (username/password was correct) I have an Action which validates user input and, if valid, invokes a bean to authenticate the user. I presume I need three findForwards in my Action:    More>>

I am a Struts newbie attempting to write a login app.


Most (if not all) of the examples I have found online use three JSP pages:



  • login.jsp (prompts user for username/password, re-displays if invalid)

  • fail.jsp (username/password valid but incorrect)

  • success.jsp (username/password was correct)




I would like to change my app to have use only two JSP pages:



  • login.jsp (prompts user for username/password, re-displays if invalid, re-displays if incorrect)

  • success.jsp (username/password was correct)




I have an Action which validates user input and, if valid, invokes a bean to authenticate the user.


I presume I need three findForwards in my Action:


			
return (mapping.findForward(this.FORWARD_invalid));
return (mapping.findForward(this.FORWARD_incorrect));
return (mapping.findForward(this.FORWARD_success));

How do I let the login.jsp page know which error condition to display ("invalid field", "could not authenticate", or no error)?


Am I on the right track?

   <<Less
About | Sitemap | Contact