-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Maya,

Maya menon wrote:
> I need to enable role based access to my Struts-J2EE application. ie,
> if a normal user logs in, user should see one page whereas if a
> superuser logs in he should see another page.

IU'm not sure about "best possible" design, but I have one that's
relatively simple and easy to understand.

The home page for my struts application is /user/home.do. This is mapped
to a simple action that checks the user's primary role (which is
available through a special User object that I keep in the user's
session). I simply execute this code:

return mapping.findForward(user.getPrimaryRole());

Then, in my struct-config.xml file, I have something like this:

<action path="/user/home" type="...">
    <forward name="user" path="..." />
    <forward name="staff" path="..." />
    <forward name="admin" path="..." />
</action>

Straightforward to read, and easy to implement.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFv6pa9CaO5/Lv0PARAussAJ9XpJdhYyk6RYHGuygCd/SZ3G6VUQCcChXn
T2AECKaRT9O17mPdwg58bIw=
=FK32
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to