Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

tile question

 
Hong Yi
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I add action to a common element (header.jsp) for tile layout?

thanks
 
Doug Slattery
Ranch Hand
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hong Yi,

If I understand your question, you want to use header.jsp in several tiles?.?.

That being the case, you can extend a tile from a parent. Example:

Suppose you have an action mapping in your struts-config.xml to display your home page, which you want to incorporate header.jsp


In your tiles-defs.xml, do the following:



In this case, tile:showhome inherits tile:layout which contains header.jsp.

Now, in layout.jsp, do something like this:



Now, you can reuse layout by extending it in other tiles and changing the page.body name attribute to whatever jsp applies for the other pages.

I hope that answers your question...
Aloha,
Doug

-- Nothing is impossible if I'mPossible
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic