On Fri, 10 May 2002, Byrne, Steven wrote:
> Date: Fri, 10 May 2002 21:29:17 -0400
> From: "Byrne, Steven" <[EMAIL PROTECTED]>
> Reply-To: Struts Users Mailing List <[EMAIL PROTECTED]>
> To: [EMAIL PROTECTED]
> 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: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>