Re: Can nested tile layouts be done?
I was able to get it working now. Thanks. On 8/16/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: It can get a little difficult to keep up with. Basically, you have to know the Hierarchy of your tile and call the top most one. In this case, you would call .base which would intern call myEndUserPage.page1 and finally myEndUserPage.jsp. to change to another.jsp you would call .anotherPage in your action forward. Nesting tiles can be very useful when switching components of a tile, but can quickly become a headache when changing tiles in both layouts. I use the nested for menus only and have been debating on switching to struts menu because of the complexity. The only thing that has prevented me from doing this is waiting to see if I can jump to JSF or AJAX/D-HTML instead. [image: Inactive hide details for Daniel Hannum [EMAIL PROTECTED]]Daniel Hannum [EMAIL PROTECTED] *Daniel Hannum [EMAIL PROTECTED]* 08/15/2005 04:55 PM Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject Re: Can nested tile layouts be done? Thanks, I think this is better. I still must be missing something about how Tiles works internally, though. In my app, the tiles definition for the end user page (the one that defines body) is called endUserPage.tiles and Tiles is smart enough to handle requests for endUserPage.jsp in the correct tiled way. You have this arranged differently, where the end user page definition has a more cryptic name (.myEndUserPage.page1) and is referenced by .base. If I do it your way, then, how does Tiles know which URL to map to the tile layout we just produced? I just implemented my layout the way you've described, but now I don't know what URL to request because tiles-config.xmlno longer contains URLs. Thanks for your help Dan On 8/15/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: OK, I see: Your definition would need to extend .sublayout.. /layout/layout /layout/layout2 definition name=.base page=/layout/layout.jsp put name=section1 page=menu.jsp put name=section2 page=.myEndUserPage.page1 /definition definition name=.anotherPage page=.base put name=section2 page=.myEndUserPage.page2 /definition Definition name=.sublayout page=/layout/layout2.jsp put name=head page=xyz.jsp put name=body page=123.jsp /definition definition name=.myEndUserPage.page1 extends=.sublayout put name=body value=/myEndUserPage.jsp/ /definition definition name=.myEndUserPage.page2 extends=.sublayout put name=body value=/another.jsp/ /definition [image: Inactive hide details for Daniel Hannum [EMAIL PROTECTED]]Daniel Hannum [EMAIL PROTECTED] *Daniel Hannum [EMAIL PROTECTED]* 08/15/2005 03:51 PM Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject Re: Can nested tile layouts be done? This still isn't working for me. I need to tweak your example because the value of body changes for each page. So if I add one more definition to my tiles-config.xml for an actual end-user page that a user would point a browser to: definition name=/myEndUserPage.tiles extends=.base put name=body value=/myEndUserPage.jsp/ /definition It's not clear which of your definitions I should extend. If I extend .base (the logical choice), I get the same behavior where the layout.jsp is rendered and layout2.jsp is substituted in, but no substitutions are made inside the layout2.jsp. If I extend .sublayout, I get even weirder behavior where it appears to render layout2.jsp but makes no substitutions at all. I looked at the Tiles examples and they don't seem to define individual pages in the tiles-config.xml, as I did above. Could that be my problem? Dan On 8/15/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Yes, this can be done. The VBox example is a good example of this. Basically it is laid out as follows. /layout/layout /layout/layout2 definition name=.base page=/layout/layout.jsp put name=section1 page=menu.jsp put name=section2 page=.sublayout /definition Definition name=.sublayout page=/layout/layout2.jsp put name=head page=xyz.jsp put name=body page=123.jsp /definition you can then substitute out different components of each section based on what you are doing. [image: Inactive hide details for Daniel Hannum [EMAIL PROTECTED]]Daniel Hannum [EMAIL PROTECTED] *Daniel Hannum [EMAIL PROTECTED]* 08/15/2005 02:18 PM Please respond to Struts Users Mailing List user@struts.apache.org
Can nested tile layouts be done?
Hi everyone, I have a question about nesting layouts with Struts tiles. I've seen this sort of thing discussed in the past, but in searching I didn't see an example that I could apply to my situation, nor did I see a good solution. Executive summary: What I want to do is have a simple layout containing two tiles, both of which are JSP's. However, one of those JSP's is actually another layout JSP, which itself contains tile placeholders. I can get Struts Tiles to do the substitutions for the first layout, but it seems to treat my second layout as a simple JSP and does not do further tiles substitutions in the second layout. Detailed description: We have two separate applications that share a common track bar at the top of the screen. Beyond that they are completely separate. So, we have a layout containing trackbar and trackcontent. Trackbar is a common jsp as you can see below. Trackcontent is simply a blackbox representing the rest of the app. definition name=.base page=/layout/layout.jsp put name=trackbar value=/common/trackbar.jsp/ /definition Then I made two definitions that put in the appropriate subsititution for trackcontent. *BUT* note that both of those JSP's have their own Tiles placeholders called menu and body. It's necessary to do this because the apps may have different layouts but they must share the trackbar above. definition name=.app1base extends=.base put name=trackcontent value=/layout/app1Layout.jsp/ /definition definition name=.app2base extends=.base put name=trackcontent value=/layout/app2Layout.jsp/ /definition Then, since all the pages of a single app share an app-specific menu, I made another definition put the right page in for menu definition name=.app1 extends=.app1base put name=menu value=/common/app1NavBar.jsp/ /definition definition name=.app2 extends=.app2base put name=menu value=/common/app2NavBar.jsp/ /definition Lastly, we have two actual pages that extend the app definitions and put the right values in for body definition name=/app1page1.tiles extends=.app1 put name=body value=/app1page1.jsp/ /definition definition name=/app2page1.tiles extends=.app2 put name=body value=/app2page1.jsp/ /definition Now, when I put all this together and point my browser at, say, app1page1, I get the top-level layout and the trackbar rendered, and it renders the appropriate trackcontent for app1, but it does NOT do the second level of substitutions (i.e. substitute the correct menu and body) Is Struts capable of doing this sort of two-level layout indirection? If so, how should I change my tile defs and layouts to make it work. Thanks a lot! Dan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can nested tile layouts be done?
This still isn't working for me. I need to tweak your example because the value of body changes for each page. So if I add one more definition to my tiles-config.xml for an actual end-user page that a user would point a browser to: definition name=/myEndUserPage.tiles extends=.base put name=body value=/myEndUserPage.jsp/ /definition It's not clear which of your definitions I should extend. If I extend .base (the logical choice), I get the same behavior where the layout.jsp is rendered and layout2.jsp is substituted in, but no substitutions are made inside the layout2.jsp. If I extend .sublayout, I get even weirder behavior where it appears to render layout2.jsp but makes no substitutions at all. I looked at the Tiles examples and they don't seem to define individual pages in the tiles-config.xml, as I did above. Could that be my problem? Dan On 8/15/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Yes, this can be done. The VBox example is a good example of this. Basically it is laid out as follows. /layout/layout /layout/layout2 definition name=.base page=/layout/layout.jsp put name=section1 page=menu.jsp put name=section2 page=.sublayout /definition Definition name=.sublayout page=/layout/layout2.jsp put name=head page=xyz.jsp put name=body page=123.jsp /definition you can then substitute out different components of each section based on what you are doing. [image: Inactive hide details for Daniel Hannum [EMAIL PROTECTED]]Daniel Hannum [EMAIL PROTECTED] *Daniel Hannum [EMAIL PROTECTED]* 08/15/2005 02:18 PM Please respond to Struts Users Mailing List user@struts.apache.org To user@struts.apache.org cc Subject Can nested tile layouts be done? Hi everyone, I have a question about nesting layouts with Struts tiles. I've seen this sort of thing discussed in the past, but in searching I didn't see an example that I could apply to my situation, nor did I see a good solution. Executive summary: What I want to do is have a simple layout containing two tiles, both of which are JSP's. However, one of those JSP's is actually another layout JSP, which itself contains tile placeholders. I can get Struts Tiles to do the substitutions for the first layout, but it seems to treat my second layout as a simple JSP and does not do further tiles substitutions in the second layout. Detailed description: We have two separate applications that share a common track bar at the top of the screen. Beyond that they are completely separate. So, we have a layout containing trackbar and trackcontent. Trackbar is a common jsp as you can see below. Trackcontent is simply a blackbox representing the rest of the app. definition name=.base page=/layout/layout.jsp put name=trackbar value=/common/trackbar.jsp/ /definition Then I made two definitions that put in the appropriate subsititution for trackcontent. *BUT* note that both of those JSP's have their own Tiles placeholders called menu and body. It's necessary to do this because the apps may have different layouts but they must share the trackbar above. definition name=.app1base extends=.base put name=trackcontent value=/layout/app1Layout.jsp/ /definition definition name=.app2base extends=.base put name=trackcontent value=/layout/app2Layout.jsp/ /definition Then, since all the pages of a single app share an app-specific menu, I made another definition put the right page in for menu definition name=.app1 extends=.app1base put name=menu value=/common/app1NavBar.jsp/ /definition definition name=.app2 extends=.app2base put name=menu value=/common/app2NavBar.jsp/ /definition Lastly, we have two actual pages that extend the app definitions and put the right values in for body definition name=/app1page1.tiles extends=.app1 put name=body value=/app1page1.jsp/ /definition definition name=/app2page1.tiles extends=.app2 put name=body value=/app2page1.jsp/ /definition Now, when I put all this together and point my browser at, say, app1page1, I get the top-level layout and the trackbar rendered, and it renders the appropriate trackcontent for app1, but it does NOT do the second level of substitutions (i.e. substitute the correct menu and body) Is Struts capable of doing this sort of two-level layout indirection? If so, how should I change my tile defs and layouts to make it work. Thanks a lot! Dan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can nested tile layouts be done?
Thanks, I think this is better. I still must be missing something about how Tiles works internally, though. In my app, the tiles definition for the end user page (the one that defines body) is called endUserPage.tiles and Tiles is smart enough to handle requests for endUserPage.jsp in the correct tiled way. You have this arranged differently, where the end user page definition has a more cryptic name (.myEndUserPage.page1) and is referenced by .base. If I do it your way, then, how does Tiles know which URL to map to the tile layout we just produced? I just implemented my layout the way you've described, but now I don't know what URL to request because tiles-config.xmlno longer contains URLs. Thanks for your help Dan On 8/15/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: OK, I see: Your definition would need to extend .sublayout.. /layout/layout /layout/layout2 definition name=.base page=/layout/layout.jsp put name=section1 page=menu.jsp put name=section2 page=.myEndUserPage.page1 /definition definition name=.anotherPage page=.base put name=section2 page=.myEndUserPage.page2 /definition Definition name=.sublayout page=/layout/layout2.jsp put name=head page=xyz.jsp put name=body page=123.jsp /definition definition name=.myEndUserPage.page1 extends=.sublayout put name=body value=/myEndUserPage.jsp/ /definition definition name=.myEndUserPage.page2 extends=.sublayout put name=body value=/another.jsp/ /definition [image: Inactive hide details for Daniel Hannum [EMAIL PROTECTED]]Daniel Hannum [EMAIL PROTECTED] *Daniel Hannum [EMAIL PROTECTED]* 08/15/2005 03:51 PM Please respond to Struts Users Mailing List user@struts.apache.org To Struts Users Mailing List user@struts.apache.org cc Subject Re: Can nested tile layouts be done? This still isn't working for me. I need to tweak your example because the value of body changes for each page. So if I add one more definition to my tiles-config.xml for an actual end-user page that a user would point a browser to: definition name=/myEndUserPage.tiles extends=.base put name=body value=/myEndUserPage.jsp/ /definition It's not clear which of your definitions I should extend. If I extend .base (the logical choice), I get the same behavior where the layout.jsp is rendered and layout2.jsp is substituted in, but no substitutions are made inside the layout2.jsp. If I extend .sublayout, I get even weirder behavior where it appears to render layout2.jsp but makes no substitutions at all. I looked at the Tiles examples and they don't seem to define individual pages in the tiles-config.xml, as I did above. Could that be my problem? Dan On 8/15/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Yes, this can be done. The VBox example is a good example of this. Basically it is laid out as follows. /layout/layout /layout/layout2 definition name=.base page=/layout/layout.jsp put name=section1 page=menu.jsp put name=section2 page=.sublayout /definition Definition name=.sublayout page=/layout/layout2.jsp put name=head page=xyz.jsp put name=body page=123.jsp /definition you can then substitute out different components of each section based on what you are doing. [image: Inactive hide details for Daniel Hannum [EMAIL PROTECTED]]Daniel Hannum [EMAIL PROTECTED] *Daniel Hannum [EMAIL PROTECTED]* 08/15/2005 02:18 PM Please respond to Struts Users Mailing List user@struts.apache.org To user@struts.apache.org cc Subject Can nested tile layouts be done? Hi everyone, I have a question about nesting layouts with Struts tiles. I've seen this sort of thing discussed in the past, but in searching I didn't see an example that I could apply to my situation, nor did I see a good solution. Executive summary: What I want to do is have a simple layout containing two tiles, both of which are JSP's. However, one of those JSP's is actually another layout JSP, which itself contains tile placeholders. I can get Struts Tiles to do the substitutions for the first layout, but it seems to treat my second layout as a simple JSP and does not do further tiles substitutions in the second layout. Detailed description: We have two separate applications that share a common track bar at the top of the screen. Beyond that they are completely separate. So, we have a layout containing trackbar and trackcontent. Trackbar is a common jsp as you can see below. Trackcontent is simply a blackbox representing the rest of the app. definition name=.base page=/layout/layout.jsp put name=trackbar value=/common/trackbar.jsp/ /definition Then I made two definitions that put in the appropriate subsititution for trackcontent. *BUT* note that both