About Me

My photo
"Enoughtheory.com" had its humble beginning in the year 2011 by ( Founder of Enoughtheory.com ) Mr Ravi Kant Soni , an Enterprise Java and Spring Framework Specialist, with a bachelor degree (B.E) in Information Science and Engineering from Reva Institute of Technology at Bangalore. He has been into the software development discipline for many years now. Ravi has worn many hats throughout his tenure, ranging from software development, designing multi-tenant applications, integration of new technology into an existing system, to his current love of writing a Spring Framework book. Currently, he is a lead engineer at HCL Technology. Ravi has focused on Web and Enterprise development using Spring Framework for most of his career and has been extensively involved in application design and implementation. He has developed applications for Core-Bank, HR and Payroll System, and e-Commerce systems using Spring Framework. Ravi Kant Soni is author of book "Learning Spring Application development" http://learningspringapplicationdevelopment.com

Sunday 13 November 2011

SiteMesh


SiteMesh3 Overview

  • SiteMesh is a web-page layout and decoration framework
  • SiteMesh intercepts requests to any static or dynamically generated HTML page requested through the web-server, processes the content and then merges it with one or more decorators to build the final result.
  • Sitemesh removes your burden of including layout related files in each and every page of your application.
Lets take a look at what sitemesh does

  • Normally websites have a common layout for all the pages. There is a header, navigation on top or left or right and a footer. Generally in such a site, we use jsp:include on every page to include the header, navigation and footer. This creates maintenance problems.
  • By using Sitemesh, we don’t need to include the header, navigation and footer into each and every page. We create only the content of the page, Sitemesh adds the header, navigation etc to the page.

Work flow:

SiteMesh in web applications

  • In a web application, SiteMesh acts as a Servler Filter.
  • It allows requests to be handled by the Servlet engine as normal, but the resulting HTML (referred to as the content) will be intercepted before being returned to the browser.
  • The intercepted content has certain properties extracted (typically the contents of the <title><head> and <body> tags and is then passed on to a second request that should return the common look and feel for the site (referred to as the decorator).
  • The decorator contains placeholders for where the properties extracted from the content should be inserted.
  • a key component of the SiteMesh architecture is the content processor. This is an efficient engine for transforming and extracting content from HTML content.
  • As with most sites, there is a header, a navigation at the top, a navigation on the left, the content goes on the right and there is a footer at the bottom.
  • If we use sitemesh, we’ll create a template page which will have the layout related to the site. That template will be applied to every page of the site.
Create a page that will contain the header, navigations and footer etc
  • SiteMesh uses a filter to intercept every request that is received by the application which we might want Sitemesh to process.
  • Sitemesh uses a configuration document (decorators.xml) to see which layout or template (called decorator) to apply to the request (if required). 

No comments:

Post a Comment