Have you thought of making a common superclass for your actions - that
class could implement the all session tracking functionality you need.

Paul
------------------------------------------------------------
Global Equity Derivatives Technology
Deutsche Bank [/]
Office +44 (0)20 754 55458
Mobile +44 (0)7736 299483
Fax +44 (0)20 7547 2752
------------------------------------------------------------

-----Original Message-----
From: Dave Bender [mailto:[EMAIL PROTECTED] 
Sent: 03 September 2004 14:23
To: Struts Users Mailing List
Subject: RE: Staying relative

Joe, 

Thanks for the reply.  I'll take a look at modules this morning.  That
seems like a good solution.  If I understand them correctly, I can
create six different modules that all point to the same collection of
actions and they'd all keep the users 'in their own spot.'

On your second point, having different paths vs. creating a session
variable, here's my thinking so far (I'm open to doing things
differently; this is just how I'm coming into it as a Struts newbie):

- I'm using the URLs to determine which section the user is in.  That's
what's making it critical that I have control of the URLs.  

- I thought about using a session variable, but it seems more unwieldy
than using URLs.  A detail I didn't mention in my initial posting is
that some of the users of the site will be in more than one group.  It's
conceivable that they could jump from one section to another midway
through a work-flow.  

If they do so and the application is watching the URLs, a switch in
sections should be quick and easy to find.   If I'm using a session
variable, I need to pay attention to that with every request.  That
seems like more responsibility than I want to take on if I don't have
to. 

Now, on to those modules....

Dave






-----Original Message-----
From: Joe Germuska [mailto:[EMAIL PROTECTED]
Sent: Friday, September 03, 2004 7:52 AM
To: Struts Users Mailing List
Subject: Re: Staying relative


Dave:

One way to get Struts to rewrite action paths with more context is to 
use modules; if your users really stay "within" an area, then using 
Modules to partition your app will result in all Struts URL rewriting 
to prepend the paths with both the servlet context path and the 
module context path.

But as I'm absorbing your application design, I'm not sure I see why 
you have different paths; if you want to reuse the same pages and if 
the behavior is essentially the same, then why not establish a "group 
identifier" in the session at user authentication time, and then just 
use a single tree of behaviors in which all the code is aware that 
users have group IDs and that the code's behavior is likely to be 
dependent on the value of that ID.

Have I oversimplified your app?  Even if you can come up with 
exceptions, you still might be better off shifting the awareness of 
groups into code and out of the config.

Does this help?

Joe



At 8:38 PM -0500 9/2/04, Dave Bender wrote:
>I'm new to Struts and liking it so far.  But I'm stumped on how I 
>can get a user of my web application to stay in the same 
>subdirectory throughout the workflow without going through a lot of 
>hoops. 
>
>Here's what I mean.  Our application will be used by 100 people 
>divided into six work groups.  Each group has access only to their 
>section of the web site.  And each section of the web site will have 
>about five different functions, for example an upload a file 
>section, an Events listing section, an bulletin board section.
>
>The code/functionality in each section is identical from group to 
>group, so I want to use the same set of JSPs and Actions for each 
>group.  (That re-use thing.)
>
>To make the security managable, I've organized the site (and 
>corresponding URLs) in a directory hierarchy like this:
>
>/app1/areas/group1/section1
>/app1/areas/group1/section2
>/app1/areas/group1/section3
>       ...
>/app1/areas/group2/section1
>/app1/areas/group2/section2
>/app1/areas/group2/section3
>       ...
>
>Where I'm having trouble is staying in the same section.  If a 
>member of group1 goes to section1, and my actions are defined like 
>this :
>
>      <action forward="input.jsp" path="input" />
>
>that takes the user to /app1/input.do, which is outside the 
>"section".  If I change my actions to specify the absolute path for 
>each Action, it works, but I have to create six sets of actions, one 
>for each section, like this:
>
>      <action forward="input.jsp"
path="/app1/areas/group1/section1/input" />
>
>That works, but ... is that how I'm *supposed* to to do it?  I'm 
>just getting started and I've got a butt-load of Actions.  I don't 
>want to manage them in sextuples.  That seems repetitive and error 
>prone, along with being a maintenance headache. 
>
>Any help would be appreciated.  It seems like this problem must have 
>been solved elegantly somehow, but I'm lost as to how.
>
>Dave


-- 
Joe Germuska            
[EMAIL PROTECTED]  
http://blog.germuska.com    
"In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn 
back; I'll know I'm in the wrong place."
    - Carlos Santana

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

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

Reply via email to