Hi,


There is an example on how to retrieve the tile context in org.apache.struts.webapp.tiles.test.TestActionTileAction.
A tile context is created each time a tile is inserted. The tile context is hold in a ComponentContext object.


Hope this help,

Cedric

William Salvucci wrote:

tiles context? How do I get that?

The logon.jsp has a struts html:form attribute that is associated to the action class.



[EMAIL PROTECTED] 06/23/03 06:05AM >>>




William Salvucci wrote:



with the following tiles-def, I can forward to layout.main and everything is fine:

definition name="layout.main" path="/layoutMain.jsp">
  <put name="header" value="header.jsp" />
  <put name="app" value="layout.app" />
  <put name="footer" value="footer.jsp" />
</definition>

<definition name="layout.app" path="/layoutApp.jsp">
  <put name="mainMenu" value="menu.main" />
  <put name="subMenu" value="subMenu.jsp" />
  <put name="body" value="welcome.jsp" />
</definition>

<!-- Menu bar definition -->
<definition name="menu.main" path="/menu.jsp" >
<putList name="items" >
  <add value="Item 1" />
  <add value="Item 2" />
  <add value="Item 3" />
</putList>
</definition>

I then modify the tiles-def so that in layout.main app = "logon.jsp" where logon.jsp submit is associated with a struts action. In the struts action I set the layout.main app = "layout.app"

ComponentDefinition layout = TilesUtil.getDefinition("layout.main", request, 
this.servlet.getServletContext());
    layout.put("app", "layout.app");




It is not recommended to change a definition dynamically, unless you know very well what you do. A definition content is shared by all the website. Changing the content will be reflected to all user of the definition. If you want to change a definition attribute for the current tiles, you should do so in the tile context, which hold a temporary copy of the definition.



and forward to "layout.main". So basically after the action everything should be the same as my original setup. However, I get the following error on the forward

<Jun 20, 2003 1:16:00 PM EDT> <Error> <HTTP> <Included resource or file "/netl-c
ommons/layout.app" not found from requested resource "/netl-commons/layoutMain.j
sp".>




The layout.app name has been interpreted as an URL. It appear that the Tiles mechanism hasn't catch it.
I don't see how you call the action from the logon.jsp page.


Cedric



layoutMain.jsp is not changed during my update and looks like

<TABLE border="1">
<TR><TD COLSPAN="2"><tiles:insert attribute="header"/></TD></TR>
<TR><TD COLSPAN="2"><tiles:insert attribute="app" /> </TD></TR>
<TR><TD COLSPAN="2"><tiles:insert attribute="footer"/></TD></TR>
</TABLE>

Any idea why layoutMain.jsp could load layout.app in the original, but can't when I programatically put it into layout.main? I noticed that the put method doesn't have type as an argument for specifying "string", "page", "definition", so I hope that isn't it.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]









---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to