Page Layout Template
Here's a FreeMarker macro that you can use to apply a standard layout to your pages. For parameters, it can optionally handle a title, css and javascript includes, and a passthrough for meta tags or whatever else you want in the HEAD section of the page.
note: you'll need to change the context path. (See <#assign path = actionBean.contextPath >"
) The way I'm doing it is probably dumb and likely won't work in your setup.
example webpage using the macro
<@page title="your page title" css=["/layout/css/default.css", "/layout/css/foo/foo.css"] js=["/layout/js/prototype/prototype.js", "/layout/js/foo/gratuitousUseOfJavascript.js"] other=[perhapsMoreJavascriptFromAnAssignTag] > ...page content... </@page>
the page layout macro
<#macro page title="DefaultTitle" css=["/layout/css/base.css"] js=[] other=[]> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>${title} - YourCompanyName or Whatever</title> <link rel="shortcut icon" xhref="/layout/favicon.ico" /> <!-- FIXME: --> <#assign path = actionBean.contextPath > <#list js as file> <script type="text/javascript" xsrc="${path}${file}"></script> </#list> <#list other as passthrough> ${passthrough} </#list> <#list css as file> <style type="text/css" media="all">@import ${path}${file};</style> </#list> </head> <body> <div id="contentBody"> <#nested> </div> <!-- end contentBody --> <div id="footer"> Copyright ©2006 YourCompanyName, Inc. or whatever footer you want </div> </body> </html> </#macro>