An alternative to this would be to build the forward string at runtime,
something like

String forward = null;
if(user.isSysAdmin()){
        forward = "sysadmin";
} else if(user.isAdmin()){
        forward = "admin";
}
return mapping.findForward(forward);

It's very much horses for courses as to how you do it, but my preference
lies with the approach above as it helps to avoid multiple return statements
from the same method.
(You'll obviously need to make sure that something is assigned to the String
before you return, though!!)

This has definitely come up before, so I think there's a bit more on this
approach in the mail archive somewhere if it helps.

Rgds
David

-----Original Message-----
From: Anand Raman [mailto:[EMAIL PROTECTED]]
Sent: 26 February 2001 10:26
To: [EMAIL PROTECTED]
Subject: Re: forwarding to different web pages


define seperate action mappings and depending on the login forward the
guy to the appropriate mapping..

if(user.isSysAdmin()) 
        return mapping.findForward("sysadmin");
else if(user.isAdmin())
        return mapping.findForward("admin");

Hope this helps
Anand Raman

On Mon, Feb 26, 2001 at 03:38:08PM +0800, Eric Wang wrote:
>I am new to Struts and pardon me if this question had been answered
previously.
>
>Currently I am working on a login module. How can I forward the user to
>different pages after they had successful login.
>for example, system administrator route to one page. Normal user route to
>another page. Error route to another page.
>
>Thanks in advance.
>Eric

************************************************************************
The information in this email is confidential and is intended solely
for the addressee(s).
Access to this email by anyone else is unauthorised. If you are not
an intended recipient, you must not read, use or disseminate the
information contained in the email.
Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be the views of
The Capital Markets Company.

http://www.capco.com
***********************************************************************

Reply via email to