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 he开发者_StackOverflow中文版ader, 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?
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.
精彩评论