Use sitemesh establish a composite view - 1.hello (Author: chen-neu, available to
Huihoo.com released)
Build a composite view using Sitemesh - 1.Hello <- Now
Establish a composite view using Sitemesh - 2. Decorator
Establish a composite view using Sitemesh - 3. Other discussion
SiteMesh is one of the J2EE application frames developed by the OpenSymphony team to increase the maintenanceability and reuse of the page. Another widely known framework of OpenSymphony is a representation frame for webwork as a web layer. They are all open source and can be found under www.sf.net.
Examples apply to the following big projects: http://opensource.thoughtworks.com/projects/sitemesh.html
Www.jboss.org www.theserverside.com www.opensymphony.com www.opensymphony.com www.Opensymphony.com www.atlassian.com
Introduction: SiteMesh Apply Decorator mode, intercept request and response with Filter, combine the page component head, content, and banner as a complete view. Usually we all use the include label to constantly include all kinder, stylesheet, scripts and footer, now, we can have a happy to delete them with the help of Sitemesh. As shown below, you want to easily reach the composite view mode, then read this article. Hello Sitemesh:
The definition of the following Filter in Web-INF / Web.xml:
filter>
filter-mapping>
taglib>
taglib>
COPY JAR and DTD files to the corresponding directory, access the cvs of OpenSymphony.SourceForge.NET to get the latest version of Sitemesh.
SiteMesh.jarWeb-INF / LIB SiteMesh-Decorator.tldWeb-INF SiteMesh-Page.TLDWEB-INF Create WEB-INF / DECORATORTORS.XML Description Each decorator page (which can be used as Sitemesh example).
decorator>
decorators> Creating an decorator page /_Decorators/main.jsp
<% @ page contenttype = "text / html; charset = GBK"%>
<% @ Taglib Uri = "SiteMesh-Decorator" prefix = "decorator"%>
hEAD>
This page is only one sentence, it is this sentence. p>
body>
html> Last Access INDEX.JSP will generate the following page: Moreover, all pages will be like Index.jsp, which is modified by Sitemesh's Filter using decorative mode, but does not have to use the include label.