You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Byrne, Steven" <sb...@dorado.com> on 2002/05/14 19:42:16 UTC
RE: Leaving "Subapp Motel"? (actions check in, but they don't checkout)
Thanks for the info -- this is what I was looking for. I tried the
contextRelative option, but it seemed that it did something surprising,
like referred to the message resources from the "from" subapp instead of
those associated with the "to" app, so I figured I wasn't using it
correctly.
SwitchAction sounds like what I was looking for. Thank Craig!!!
Steve
-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org]
Sent: Monday, May 13, 2002 6:11 PM
To: Struts Users Mailing List
Subject: Re: Leaving "Subapp Motel"? (actions check in, but they don't
checkout)
On Fri, 10 May 2002, Byrne, Steven wrote:
> Date: Fri, 10 May 2002 21:29:17 -0400
> From: "Byrne, Steven" <sb...@dorado.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: struts-user@jakarta.apache.org
> Subject: Leaving "Subapp Motel"? (actions check in, but they don't
check out)
>
> Ok -- I'll bite -- I've finally discovered what sub-applications are
all
> about [hint -- the documentation needs improving in this area]. It's
> pretty easy to see how to transition into a subapplication from the
> default subapplication, but I'm not sure what syntax to use in a
forward
> to reference a non-context and non-application-relative URI.
>
> Of course, I could always use an absolute URL, but that would mean
that
> I would have to either hard code that into my struts-config.xml file
> (bad), or programmatically determine it (bad).
>
There isn't really anything new in 1.1 that helps with references to
things external to the current webapp. You're still stuck with absolute
URLs for that.
What is supported for you is that references starting with a slash are
assumed to be relative to the current subapp, instead of the context
path,
in all scenarios. This is what makes it possible to use the same
struts-config.xml file for either the "root" subapp or a different one.
> I think there must be something I'm missing in my understanding of
this
> useful technology for supporting modular, decoupled web application
> development. Can someone explain how I get out of the roach (subapp)
> motel?
>
One thing that is definitely not clear in the docs (yet) is how to get
from one subapp to another in the same web application. There are a
couple of different techniques supported, for use in various
circumstances:
* In a <forward> declaration, you can add the new contextRelative="true"
attribute, to indicate that a path starting with "/" should be
interpreted as context-relative, instead of subapp-relative. You
will be switched to the new subapp when the controller does its
forwarding.
* In an Action, you can call RequestUtils.selectApplication() yourself,
and specify the subapp prefix of the sub-application you want to
switch to. From that moment on, all intra-subapp references will be
resolved against the new subapp instead of the old one.
* A new standard action (org.apache.struts.actions.SwitchAction) lets
you forward control to a particular subapp-relative URI within a
particular subapp selected by the subap prefix. This is useful in
menu pages.
> Steve
>
>
Craig
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>