Question

In Struts2, how do you share your common html across all pages?

In Asp.net, you've got Master pages, and in Rails there are Layouts. The idea is that your common html (eg the header, menu, and styles) are all easy to maintain because they are in one place, but for the life of me i can't find the equivalent feature in Struts2.

Is it called something else, or something, is that why i can't find it?

Was it helpful?

Solution

I have used both Tiles2 and SiteMesh to accomplish this.

Tiles is configuration based where you define pages and their structure (usually in xml)

SiteMesh is based on decorators where you have a template that is applied through a filter to the resulting page. SiteMesh uses more memory on the server side because of the re-styling done in the filter, so the html of the result page must be parsed and applied.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top