You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Marian Schedenig <m....@gmx.at> on 2004/04/07 20:14:11 UTC

Module navigation

In our Struts-/Tile-based web application, we have troubles navigating between 
modules. A simplified scenario looks like this:

Default module - Portal page, login,...
Module "users" - User management
Module "admin" - Administration & settings
...

All pages are based on one basic Tiles definition, which also includes a menu 
bar for navigating between the various parts of the application. Therefore, 
we need a way to have links in the menu JSP which work from any of our 
modules.

Right now, we use simple "a href" HTML tags, but since they require that we 
specify the complete path relative to our server (including the webapp name), 
this is not a permanent solution.

Another possibility seems to be using a SwitchAction, but this action would 
have to be defined in each module's struts config. I'd prefer a solution 
where we don't have to duplicate this kind of data, as I fear it could 
quickly lead to inconsistencies.

According to the online documentation for the HTML taglib, the "link" tag 
should have a "modules" attribute that would allow us to specify the module 
for each link in the link itself. However, none of the HTML taglib versions I 
tried (and I downloaded the latest stable/official version) seem to know this 
attribute ("module" cannot be found in the entire TLD).

So my question is: Is there a simple way to specify module-independent (i.e. 
independent from the *current* module) way to use the same JSP with the same 
links from several modules?

And a related problem: Is it possible to make the non-default modules aware of 
the Global Forwards and Exceptions specified in the default module? As with 
the SwitchAction, I would like to avoid duplicating this kind of data for all 
our modules.

Thanks in advance,
Marian.

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


Re: Module navigation

Posted by Marian Schedenig <m....@gmx.at>.
On Thursday 08 April 2004 20:14, Bill Siggelkow wrote:
> The "module" attribute is available on the html:link tag in Strut 1.2.

I see. I couldn't find any version information in the taglib doc.

> One thing you could try would be using the "href" attribute with a
> relative URL.
>
> <html:link href="../user/foo.do">Goto User Foo</html:link>

That's what we've been doing so far. Problem is, the relative links are 
different in the sub modules and the default module (which doesn't have 
the /modulename/ part in the URL).

Jason Miller's tip was perfect though - problem solved. :)

Thanks,
Marian.

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


Re: Module navigation

Posted by Bill Siggelkow <bi...@bellsouth.net>.
The "module" attribute is available on the html:link tag in Strut 1.2. 
One thing you could try would be using the "href" attribute with a 
relative URL.

<html:link href="../user/foo.do">Goto User Foo</html:link>

As you said, you could also use the SwitchAction.

Marian Schedenig wrote:
> In our Struts-/Tile-based web application, we have troubles navigating between 
> modules. A simplified scenario looks like this:
> 
> Default module - Portal page, login,...
> Module "users" - User management
> Module "admin" - Administration & settings
> ...
> 
> All pages are based on one basic Tiles definition, which also includes a menu 
> bar for navigating between the various parts of the application. Therefore, 
> we need a way to have links in the menu JSP which work from any of our 
> modules.
> 
> Right now, we use simple "a href" HTML tags, but since they require that we 
> specify the complete path relative to our server (including the webapp name), 
> this is not a permanent solution.
> 
> Another possibility seems to be using a SwitchAction, but this action would 
> have to be defined in each module's struts config. I'd prefer a solution 
> where we don't have to duplicate this kind of data, as I fear it could 
> quickly lead to inconsistencies.
> 
> According to the online documentation for the HTML taglib, the "link" tag 
> should have a "modules" attribute that would allow us to specify the module 
> for each link in the link itself. However, none of the HTML taglib versions I 
> tried (and I downloaded the latest stable/official version) seem to know this 
> attribute ("module" cannot be found in the entire TLD).
> 
> So my question is: Is there a simple way to specify module-independent (i.e. 
> independent from the *current* module) way to use the same JSP with the same 
> links from several modules?
> 
> And a related problem: Is it possible to make the non-default modules aware of 
> the Global Forwards and Exceptions specified in the default module? As with 
> the SwitchAction, I would like to avoid duplicating this kind of data for all 
> our modules.
> 
> Thanks in advance,
> Marian.


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


Re: Module navigation

Posted by Marian Schedenig <m....@gmx.at>.
On Thursday 08 April 2004 20:14, Jason Miller wrote:
> I found a solution to this problem by defining the global forwards and
> resources in a common configuration file, then using that common
> configuration in each module (in addition to the module specific configs.)

Excellent. This is EXACTLY what I was looking for! :)

I had been thinking about and experimenting with multiple comma separated 
config files, but I never had the idea to combine that with modules. Now it 
works fine.

Thanks a lot,
Marian.

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


Re: Module navigation

Posted by Jason Miller <ja...@danteconsulting.com>.
I was faced with something similar in my last project - while the app 
was split into multiple modules (13, to be exact,) there were several 
things that I needed to be truly global, like various forwards, and 
certain resource bundles.

I found a solution to this problem by defining the global forwards and 
resources in a common configuration file, then using that common 
configuration in each module (in addition to the module specific configs.)

Basically, if you comma separate config files in the module config 
param, struts will load each in turn and use them as the configuration 
for the module.  It looks something like this:

<init-param>
     <param-name>config</param-name>
     <param-value>/WEB-INF/conf/struts-default.xml,
                  /WEB-INF/conf/struts-common.xml</param-value>
</init-param>
<init-param>
     <param-name>config/admin</param-name>
     <param-value>/WEB-INF/conf/struts-admin.xml,
                  /WEB-INF/conf/struts-common.xml</param-value>
</init-param>

I used the global forwards defined in the common file for all cross 
module navigation.  Made things somewhat simpler, and kept everything in 
one place.

Jason


Marian Schedenig wrote:

> In our Struts-/Tile-based web application, we have troubles navigating between 
> modules. A simplified scenario looks like this:
> 
> Default module - Portal page, login,...
> Module "users" - User management
> Module "admin" - Administration & settings
> ...
> 
> All pages are based on one basic Tiles definition, which also includes a menu 
> bar for navigating between the various parts of the application. Therefore, 
> we need a way to have links in the menu JSP which work from any of our 
> modules.
> 
> Right now, we use simple "a href" HTML tags, but since they require that we 
> specify the complete path relative to our server (including the webapp name), 
> this is not a permanent solution.
> 
> Another possibility seems to be using a SwitchAction, but this action would 
> have to be defined in each module's struts config. I'd prefer a solution 
> where we don't have to duplicate this kind of data, as I fear it could 
> quickly lead to inconsistencies.
> 
> According to the online documentation for the HTML taglib, the "link" tag 
> should have a "modules" attribute that would allow us to specify the module 
> for each link in the link itself. However, none of the HTML taglib versions I 
> tried (and I downloaded the latest stable/official version) seem to know this 
> attribute ("module" cannot be found in the entire TLD).
> 
> So my question is: Is there a simple way to specify module-independent (i.e. 
> independent from the *current* module) way to use the same JSP with the same 
> links from several modules?
> 
> And a related problem: Is it possible to make the non-default modules aware of 
> the Global Forwards and Exceptions specified in the default module? As with 
> the SwitchAction, I would like to avoid duplicating this kind of data for all 
> our modules.
> 
> Thanks in advance,
> Marian.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

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