... might be a bit simplistic, but could you perhaps name your forwards after your roles and just have your action handle things that way? ... if the model is the same ... Then, you wouldn't have to touch the Action class unless your model needed tweaking.

Another thing you could condier is having a factory that manufactured classes, based on role, which would setup the model appropriately and ... hrm ... I probably would keep using the role name to deduce the forward.

... the manufactured classes might be singletons to reduce the need for object creation/destruction.

You'd reduce the liklihood of having to change anything unless you added a role. In that case, you'd update the config file for your factory and add in the new class and forward and ... *zoom* *zoom* *zoom* to the *BOOM* *BOOM*!

... ... yeah ... there's probably a better way :-) I like to compartmentalize things though and this approach would certainly do that. It suffers from "many little objects"-itis though :-( and makes it a lot less obvious where the code is that is actually doing the work. It's not a lot harder, but you might consider who will be stepping in once you're gone to do maintenance when you decide on a final implementation.

Good Luck!

Eddie

----- Original Message ----- From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 22, 2004 7:46 PM
Subject: Struts and Role specific Action Forwarding



Hi,

I am using struts 1.1. There is seed version or out of box version of the application. There is requirement that
the application should be flexible enough to be customized for each client role. The roles are define in web.xml
For example when user is in Role "A" View should be like JSP "A.jsp" and when user is in the Role B view should be like JSP "B.jsp".
Model remains same more or less.
Currently we have this logic in the action class where role is checked and correct Action Forward is returned. But this approach
requires touching the action classes again when a new role is defined.
I was thinking if there is a better way of handling this logic so that I don't have to touch Action classes.
I was also trying to look into Tiles to handle this logic. But so far no success.


I will appreciate if anyone has better ideas to handle this requirement in struts environment.

Thanks

Rajesh S

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




--- avast! Antivirus: Outbound message clean. Virus Database (VPS): 0447-1, 11/19/2004 Tested on: 11/22/2004 9:22:49 PM avast! - copyright (c) 2000-2004 ALWIL Software. http://www.avast.com




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



Reply via email to