Rajesh, Just to complement Eddie Bush's assistance.
The Struts controller setup in the MVC does some data mining the ActionForm and then passes off to different actions for different business logic and to different ActionForwards for different presentation. Thus, if you are clear about what each part does, your solutions to these problems, as Eddie so easily points out, are fairly straightforward as a rule. If you need different things done, use different Actions. If you need different presentions merely, use different ActionForwards. If you need a little different of both, use different Actions and ActionForwards. However, importantly, JSP, etc. are also part of the presentation choice scheme. So, you can use a combination of different pages (JSPs or tiles) and different parts of the same page by having parts of the page displayed in the response object depending on role. I use three type of objects for the view helpers (JSPs or tile) that are used as state and set as needed : a Logic object, a Data object and a GUI object. The logic object has logic standard keys such as logic_1, logic_2, etc. that take values such as "user", "manager", "nobody", etc. These are all kept in a UserContainer. You will have your own solution. I have been working on a generic sort of solution which includes setting values in various scopes (request, page, session and application), which people may be tired of hearing about. Jack On Mon, 22 Nov 2004 21:22:47 -0600, Eddie Bush <[EMAIL PROTECTED]> wrote: > ... 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] > > -- "You can't wake a person who is pretending to be asleep." ~Native Proverb~ "Each man is good in His sight. It is not necessary for eagles to be crows." ~Hunkesni (Sitting Bull), Hunkpapa Sioux~ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]