Most pages are composed of common characteristics that we can code once and share using SiteMesh
Presentation - Composing Pages
How can we increase consistency and reduce markup?How can we offer alternate versions of a page?
SiteMesh is a frameworks in its own right, but most applications only need to use the essentials.
- ActionSupport
- ActionContext
- Interceptors
- Business Objects
Workshop - Theme
Story: MailReader must be maintained over time. A design based on page composition can be easier to update.
- Utilize include tag to reuse a common element through application
- Utilize a CSS reference to use a common theme throughout application
- Utilize SiteMesh to accomplish the same effect, without requiring a change to the original pages
Prerequisites
- CSS references
- Include tags
- SiteMesh
Exercises
- Copy the css/mailreader.css file from the CD
- Add a style reference to every page
- Add a standard footer page throughout the application that links back to the Welcome page, using the jsp:include tag
- Implement the same changes using SiteMesh instead
Hint Code
<link href="<ww:url value="/css/mailreader.css"/>" rel="stylesheet" type="text/css"/>
<%@ taglib uri="/webwork" prefix="ww" %> <hr/> <p> <a href="<ww:url action="Welcome" />"><ww:text name="index.title"/></a> </p>
Accomplishments
- Utilized include tag to reuse a common element through application
- Utilized a CSS reference to use a common theme throughout application
- Utilized SiteMesh to accomplish the same effect, without requiring a change to the original pages
Extra Credit
- Create a new theme and use SiteMesh to change over to it, without touching the pages again.
