Hello,
I'm using tiles to create a dynamic menu. It is a
collapsable/expandable menu. The code behind the menu examines the
requestURI and based on that determines which part of the menu to display.
For example, if a particulate URL was requested, I am displaying that URL
in the menu differently, as well as ensuring it's parents are visible in
the menu too. The entire menu is created on the server and the client
receive plan html.
Anyway, my problem is, that when I call request.getRequestURI from within
my tile (menu.jsp), the method returns '/WEB-INF/templates/menu.jsp, rather
than the desired URL '/mycontext/mydir/index.jsp'. Because of that, I
can't include the menu everywhere and have it automatically determine which
part of the menu to highlight as the current selection etc.
That being said, here is the relevant setup:
struts-config.xml:
<action path="/index" type="org.apache.struts.actions.ForwardAction"
parameter="tiles.index.main"/>
tiles-defs.xml:
<definition name="tiles.base.page" path
="/WEB-INF/templates/base.jsp">
<put name="title" value="Base Title Page" />
<put name="header" value
="/WEB-INF/templates/header.jsp" />
<put name="footer" value
="/WEB-INF/templates/footer.jsp" />
<put name="body" value
="/WEB-INF/templates/body.jsp" />
<put name="menu" value
="/WEB-INF/templates/menu.jsp" />
</definition>
<definition name="tiles.index.main" extends="tiles.base.page">
<put name="title" value="Some index page" />
<put name="body" value="/index-body.jsp" />
</definition>
The only thing I can think of is to put an attribute containing the URL
requested hardcoded within my tiles-defs.xml, so my menu has an idea what
the actual URL request was. However, them I lose my dynamic ability to
include my menu anywhere I wish and I've got hardcoded URLs everywhere.
Does anyone know how to get the actual URL requested by the browser from
within a tile? Does the tile library store the original requestURI as some
attribute of the request object (that would be great)? If you could point
me to the appropriate documentation, I would be most grateful.
Thanks,
Perry Tew
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]