You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "C.Aussems" <c....@xs4all.nl> on 2004/01/13 16:06:22 UTC

How to use html:link using modules and tiles

I started using modules in my struts application, but have difficulties with
links defined in a default tile.

In my default app tiles-defs.xml I have defined a base layout which is being
extended in my module tiles-defs.xml.

The base layout puts a header, menu , body & footer
<definition name="atu.base" path="/layouts/base.jsp">
 <put name="header"  value="/common/pages/header_cart.jsp" />
 <put name="menu"    value="/common/pages/menu.jsp"     />
 <put name="footer"  value="/common/pages/footer.jsp"  />
</definition>

The body put is defined in module tile def
<definition name="atu.catalog" extends="atu.base" >
 <put name="center"    value="/catalog/query.jsp"  />
</definition>

My menu has a link to the catalog module <html:link forward="/catalog" >

To switch between module contexts I have to use a SwitchAction,
which I like to define as least as possible, so in default app's
struts-config.xml

<global-forwards>
 <forward name="/catalog" path="/catalog.do"  ></forward>

 <action path="/switch" type="org.apache.struts.actions.SwitchAction" />
 <action path="/catalog" forward="/switch.do?page=/query.do&prefix=/catalog"
/>

In the default applications pages all goes well, but in any module page I
get the folowing error
[ServletException in:/common/pages/menu.jsp] Cannot create rewrite URL:
java.net.MalformedURLException: Cannot retrieve ActionForward named
/catalog'

I tried te resolve this using different Html:link attributes and so on,
but it seems I have to define all menu links as global-forwards in all
modules ??? with contextRelative="true"
and map those to the the switches in default app's struts-config.xml or even
worse define them also in all modules ??
I can't believe this because then somehow all the modules are coupled and we
dont't want that, so i'm missing something, but what ?

Corné

(prev posted on jguru)


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