You haven't discovered the contextRelative attribute yet, I see :-)

(see below)

Jeff Corliss wrote:

>Thanks, I've found and scanned through it.  I think
>there's (at least) one thing I'm still not
>understanding though and that is how to use forwards
>to move from one sub-app to another.  
>
    <forward contextRelative="true"
             name="toMember"
             path="/member/index.do"
             redirect="true"/>

That's one of my global forwards.  It wouldn't have to be global though. 
 The trick here is the 'contextRelative="true"'.  Be sure you specify a 
path relative the the application context though - that's what you're 
saying by using contextRelative - treat this path as relative to the 
application context (not the module context).

>One thing I want to do, for example, is have different
>sub-apps per the type of user who has logged in.  So
>what I'd like to do is in my LoginAction class (from
>the default sub-app), check the user's type and then
>forward them into their sub-app based on that.  
>
ok so you're looking at something like:

<forward ... name="role1" path="/role1/index.do" .../>
<forward ... name="role2" path="/role2/index.do" .../>
...
<forward ... name="roleN" path="/roleN/index.do" .../>

>Doing this with forwards seems like the way to go, but
>I don't see a "prefix" attribute available for
>forwards.  Or, since there is no prefix attribute on
>forwards, do you have to define global forwards in
>each sub-app's config and make sure that there is no
>clash in global forward names across all sub-apps?
>
If the only place you're switching sub-apps is in that one module and 
that one action, having something akin to the forwards I listed above in 
your action should do the trick (I think!).  It's really easy to switch 
sub-apps though.  Here are some ways:

    - a (global or otherwise) forward with 'contextRelative="true"'
    - use of org.apache.struts.actions.SwitchAction (passing prefix and 
page as request *parameters*)
    - ...

Ok so there are two ways :-)  I'm probably missing something here.  One 
point I should make is that I wanted to use my forwards as hyperlinks - 
that's why I made them global (<html:link forward="..."/>).  One of the 
confusions I faced was that, all of a sudden :-) "global forwards" 
didn't make sense to me.  They could be more properly called "module 
forwards".  They really aren't "global" anymore than you would consider 
instance variables global.  In fact, that's about the best analogy I can 
think of to what global forwards act like nowadays - they're like 
instance variables for the sub-app.  I fought that one a while before I 
faced the facts - it just didn't make sense to me that they would be 
called global and not propogate to all sub-apps.  They do not though! 
 That's why I chose to put them in every module - the links were to be 
visible everywhere and so they needed to work under all modules.

Hopefully that help clear the muddy waters some more.  Just yell if it 
doesn't.

-- 
Eddie Bush




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

Reply via email to