RE: [TILES] Passing attributes to tiles
What I was told was that if you think about the layout file as a method being called from the tiles definition, you are sort of calling a sub-method when you try to get to another file from inside the layout file, and when you call another method, if you want that method to be able to access a variable that is available in the top level method, you have to explicitly pass that variable to that sub-method. With your definition of: definition name=tile.1 path=tile-1.jsp put name=hideButton value=yes/ put name=body value=tile-1-body.jsp/ put name=nav value=tile-1-nav.jsp/ /definition Then, inside tile-1.jsp, where you have tiles:get name=nav/ instead, put this: tiles:insert name=nav tiles:put name=hideButton beanName=hideButton beanScope=tile / /tiles:insert -- Steve Stair [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [TILES] Passing attributes to tiles
Answering my own question. In tile-1.jsp when I define an attribute (tiles:useAttribute) with request scope, I can reference it any of the contained tiles just like any other Java bean. Sri -Original Message- From: Sri Sankaran [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2003 1:12 PM To: Struts Users Mailing List Subject: [TILES] Passing attributes to tiles Using Struts 1.1b3 Consider a simple page layout comprised of two tiles, a body and a (wizard-like) navigation bar. I would like to conditionally disable certain navigational buttons on some pages. I am trying to use the tiles:put and tiles:useAttribute to no avail. Here's a sample tile definition definition name=tile.1 path=tile-1.jsp put name=hideButton value=yes/ put name=body value=tile-1-body.jsp/ put name=nav value=tile-1-nav.jsp/ /definition I find that I can access hideButton in tile-1.jsp but not in tile-1-nav.jsp. In other words, the following works in tile-1.jsp tiles:useAttribute id=hide name=hideButton classname=java.lang.String/ Hide value is %=hide% But not in any of tile-1-body.jsp or tile-1-nav.jsp. Is this expected behavior? Do you have any suggestions on how I can achieve what I am trying? The one workaround I have is to use a bean:define in tile-1.jsp and reference that bean in tile-1-nav.jsp. Sri - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]