My company has 20+ web applications. They all use Struts2 and Sitemesh to decorate the pages.
Every application has its own version of header.html and footer.html which are included in standard.jsp (using <%@ include file=filename%>
).
For look and feel consistency across applications I want to have the header and footer files outside of the web application.
However I can't figure out how to do that!
My decorator.xml looks like this
<decorators defaultdir="/layout">
<decorator name="standard-layout" page="standard.jsp">
<pattern>/*</pattern>
</decorator>
</decorators>
My include directive <%@ include file="/common/header.html%>
, gets prefix with the defaultdir value, like this /layout/common/header.html, and I get a file not found error.
The same thing happens if I use an absolute path.
Also, the same thing happens if I change decorators.xml like this.
<decorators>
<decorator name="standard-layout" page="/layout/standard.jsp">
<pattern>/*</pattern>
</decorator>
</decorators>
Help will be appreciated!
Update: I was able to solve this using JSTL
<c:import var="commomHeader" url="/resources/html/common_header.html"/>
${commomHeader}