File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Form base authentication in Struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Form base authentication in Struts" Watch "Form base authentication in Struts" New topic

Form base authentication in Struts

Sandeep Ghosh
Ranch Hand

Joined: Jan 23, 2002
Posts: 145
Hi Friends,
I am new to Struts framework. I am trying to use form base authentication in struts .If user is in role Admin then admin.jsp will be shown else user.jsp . Do I have to extend ActionServlet and use request.isUserInRole/(admin/) for this purpose or it could be done in some other way.
Please help me immediately as I have already spent 2 days for finding solution myself.
[ December 19, 2002: Message edited by: Sonu Ghosh ]
Junilu Lacar

Joined: Feb 26, 2001
Posts: 6529

Originally posted by Sonu Ghosh:
Please help me immediately as I have already spent 2 days for finding solution myself.

I know you must be frustrated and desperate right now; we've all been through this sort of thing at one time or another. That being said, however, you should try to avoid using the words "urgent" and "immediately" in forums like this as it sometimes has the opposite effect.
You're in luck today though, JavaRanch being a friendly place for greenhorns, so I will tell you what I have done in the past:
I define forwards for my that have the same names as my user roles. That means if I have an "admin" user role, I have an "admin" forward that points to the adminhome.jsp. I do the same for other user roles. Once I determine what role the user has, then I simply use it as the argument to mapping.findForward().

Junilu - [How to Ask Questions] [How to Answer Questions]
I agree. Here's the link:
subject: Form base authentication in Struts
It's not a secret anymore!