I have developed a simple struts application which retrieves and manipulates customer data from the database. Now I want to include an image at the top of all the pages. I know tiles is the best way to do it. How to include an image in my existing project using tiles?
Asked
Active
Viewed 445 times
-4
-
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. – Roman C Aug 28 '16 at 18:09
2 Answers
2
You can find a well illustrated example here : First Struts Tiles Tutorial
Basically, you will have to :
- define a layout (template) of your pages using tiles tags (tiles:insert)
- create tiles definitions telling which jsps (or static ressources) go into the tiles:insert you defined in the layout
- adapt your struts mapping to redirect to named tiles definitions instead of jsps directly
0
First you to divided your template according to it (i.e - Make image.jsp in seprate file) after that add your jsp page where you want to display it into tiles.xml in your Example
<definition name="template">
<put-attribute name="image" value="/image.jsp"/>
<put-attribute name="header" value="/header.jsp"/>
<put-attribute name="content" value="/content.jsp"/>
<put-attribute name="footer" value="/footer.jsp"/>
</definition>
And if you don't want to display anything than simply remove it from tiles.xml

Saurabh Mehta
- 228
- 1
- 4
- 15