You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Sharma, Sanjay (LNG-DAY)" <Sa...@lexisnexis.com> on 2003/02/02 21:19:54 UTC

Issues with using Modules

 
1) There are no real global forwards and exceptions. The global are only
visibale within a module. How can I define forwards and exceptions that are
used in multiple module.
2) Forwarding between mdoules is awakward. First, if you want to forward
from an action to a jsp in another module, context-relative forward looks
attractive.  But it doesn't really swicth the modules when forwarding so it
won't work. 

So to make the forward really work, you need to:
i) Parse the path in the context-relative forward to determine the module
and module-realtive path
ii) Create a forward to a Swicth Action and specify the module-relative path
(of the JSP) as the page attribute and modules as the prefix and forward to
the Switch Action. 

This seems to be a lot of work just to accomplish a forward and also
introduces unnecessary intermediate forward. Is there a better way?

Sanjay

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Issues with using Modules

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Sun, 2 Feb 2003, Sharma, Sanjay (LNG-DAY) wrote:

> Date: Sun, 2 Feb 2003 15:19:54 -0500
> From: "Sharma, Sanjay (LNG-DAY)" <Sa...@lexisnexis.com>
> Reply-To: Struts Users Mailing List <st...@jakarta.apache.org>
> To: "'struts-user@jakarta.apache.org '" <st...@jakarta.apache.org>
> Subject: Issues with using Modules
>
>
> 1) There are no real global forwards and exceptions. The global are only
> visibale within a module. How can I define forwards and exceptions that are
> used in multiple module.

As you (correctly) point out, the term "global" in a struts-config.xml
file is currently only global within the scope of a module.  In 1.1,
modules are (essentially) totally independent of each other.

Designing some sort of mechanism where modules could "inherit from" or
"subclass" each other is likely to be a popular topic on STRUTS-DEV when
we start laying out the roadmap for Struts 1.2.  That way, you could put
parent resources of various types in a parent module, and then specialize
as desired.

> 2) Forwarding between mdoules is awakward. First, if you want to forward
> from an action to a jsp in another module, context-relative forward looks
> attractive.  But it doesn't really swicth the modules when forwarding so it
> won't work.
>

As I responded earlier to this question, that is what SwitchAction is for.
If you want to do it programmatically, use RequestUtils.selectModule()
instead.  That will guarantee that you don't have to worry about all the
messy internal details required to actually perform the switch.

> So to make the forward really work, you need to:
> i) Parse the path in the context-relative forward to determine the module
> and module-realtive path
> ii) Create a forward to a Swicth Action and specify the module-relative path
> (of the JSP) as the page attribute and modules as the prefix and forward to
> the Switch Action.
>
> This seems to be a lot of work just to accomplish a forward and also
> introduces unnecessary intermediate forward. Is there a better way?
>

See above.  RequestUtils contains an amazing number of handly utility
methods for all sorts of things like this, so the Struts Javadocs can
really be your friend :-).

> Sanjay

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org