Sorry, I cannot understand your question. Can you write a graphical scheme to show what you want to achieve?
Antonio 2009/6/21 Chris Dailey <[email protected]> > Greetings, > > I have been coming back to Java after a long hiatus, learning JSF using the > Core JavaServer Faces 2nd ed by David Geary and Cay Horstmann. Chapter 8 is > "Subviews and Tiles". It is all based on the first Tiles, and the only > tricky part of getting it to work with Tiles2 was getting the data from the > ViewPreparer that was more easily available in the old Controller. > > Anyways, for this chapter and most of the others on the net, it describes a > method of creating re-usable pieces, but they all only really show one page > using the scenario. I'm having a hard time seeing how it scales to many > pages using the same templates. If I have a scenario where I have many > pages with just the content area unique to each page (but a common header, > left nav, and footer), I think the process I have to do is: > > ONCE: > 1. Create a generic template JSP, called /template/standardHeader.jsp. It > includes place-holders (tiles:insertAttribute tags) for header, leftnav, > footer, and content. > 2. Create a definition called "standardHdr" in tiles-def with appropriate > put-attribute values for header, leftnav, and footer, as well as a default > title (but NOT content). > FOR EACH PAGE is: > > 1. Add another definition "page1definition" (or page2definition, etc.) in > the tiles-defs.xml that extends standardHdr. To the definition also I add > in the title attribute, and for the content attribute I point to a page > called "/page1content.jsp" (or page2content.jsp, etc.) > 2. Create "page1content.jsp" (or page2content.jsp, etc.), which has only > the content. > 3. Create "page1.jsp" (or page2.jsp, etc.) > > That looks like a lot of overhead for each page I want to add. Am I doing > it wrong? Is there an easier way? Maybe something with just a single file > per new page that says "here's the tiles definition to use" and "here's the > content I want to use"? > > I tried to come up with a solution using "Runtime Composition" as described > here: > http://tiles.apache.org/framework/tutorial/advanced/runtime.html > But it didn't work. You can't put JSP/JSF code within a > <tiles:putAttribute>, nor point to it using a facet, etc. As far as I can > tell you HAVE to have a separate file. > > I've done a bit of looking through documentation and Googling, but I > haven't found an example yet. Any pointers would be appreciated. > > Thanks a lot! > Chris >
