Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: Reuse Tiles and Simplify UI

JavaServer Pages (JSP) technology supports application object reuse through includes, which allow other files (including other JSPs) to be sourced into a JSP file either at compile time or dynamically at application runtime. This is great for abstracting

Tutorial Details:

JavaServer Pages (JSP) technology supports application object reuse through includes, which allow other files (including other JSPs) to be sourced into a JSP file either at compile time or dynamically at application runtime. This is great for abstracting common elements of pages such as headers, footers, and menus into reusable chunks that can be used by several files.

Includes are powerful and save time, but they still create potential for a great deal of element duplication. Each JSP file that sources in common elements duplicates the include definitions. If the names of files being included change, each of the files that references them (using includes) must also be updated.

The Tiles framework was created to address this limitation and to enhance the Struts framework. Tiles extends the concept of reuse via includes by allowing you to define layouts (or templates) and then specify how the layouts are populated with content.

With the JSP include paradigm, each JSP specifies its layout and explicitly populates that layout via includes. Most JSP layouts are identical, sourcing in the same files in the same places and then including only one section of unique content (body content). With Tiles, you define a master layout JSP that specifies each of the includes that fill in that layout, and then you define which content should fill in the layout, using an external configuration file. For example, suppose you have a typical Web site layout: a header at the top of the page, a menu on the left, body content in the middle, and a footer at the bottom. If you implement this layout using only JSP includes, each JSP with this layout has to explicitly include the header, menu, and footer sections as well as the body content of the page. The only unique part of the page is the body content. If you implement this layout with Tiles, however, you will create one JSP that includes the header, menu, and footer and you will dynamically include the body content, based on an attribute passed to the layout that indicates which JSP includes the body content. This Tiles layout can then be reused over and over for as many pages as you'd like, and the only thing your content JSPs have to contain is the specific, unique body content that goes in the middle of a page.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
Reuse Tiles and Simplify UI

View Tutorial:
Reuse Tiles and Simplify UI

Related Tutorials:

How to attach a user interface to a Jini service - JavaWorld October 1999
How to attach a user interface to a Jini service - JavaWorld October 1999
 
Become a programming Picasso with JHotDraw - JavaWorld February 2001
Become a programming Picasso with JHotDraw - JavaWorld February 2001
 
UI design with Tiles and Struts
UI design with Tiles and Struts
 
Step into the J2EE architecture and process
Step into the J2EE architecture and process
 
Evolve your apps with the Phased Process pattern
Evolve your apps with the Phased Process pattern
 
Reinvented wheel
Reinvented wheel
 
Excellent tutorial on Struts and Tiles
Excellent tutorial on Struts and Tiles This tutorial assumes knowledge of Java, JDBC, Servlets, J2EE (with regards to Web applications) and JSP Struts in a holistic manner, minus the beads and crystals. The Tiles framework makes creating reusable pages
 
Interesting concept ...
Interesting concept ...
 
Maybe the future UI design of choice
Maybe the future UI design of choice
 
JavaServer Faces Technology
JavaServer Faces technology is a server-side user interface component framework for Java technology-based Web applications.
 
Integrating Struts, Tiles, and JavaServer Faces
Integrating Struts, Tiles, and JavaServer Faces. Bring the power, flexibility, and manageability of the three technologies together.
 
Reuse Tiles and Simplify UI
JavaServer Pages (JSP) technology supports application object reuse through includes, which allow other files (including other JSPs) to be sourced into a JSP file either at compile time or dynamically at application runtime. This is great for abstracting
 
Programming Jakarta Struts: Using Tiles, Part 2
In part two in this series of book excerpts on using tiles from Programming Jakarta Struts, learn how to install and configure tiles, as well as get an overview on tiles.
 
Developing Simple Struts Tiles Application
In this tutorial I will show you how to develop simple Struts Tiles Application. You will learn how to setup the Struts Tiles and create example page with it.
 
Struts and Tiles aid component-based development
In the Java world, Struts is one of the best-known and most talked about open source embodiments of MVC.
 
Using tiles-defs.xml in Tiles Application
In this lesson you will learn how to define and use the "plugin" definitation in tiles-defs.xml file.
 
Open Source Web Frameworks in Java
Open Source Web Frameworks in Java Open Source Web Frameworks in Java Struts Struts Frame work is the implementation of Model-View-Controller (MVC) design pattern for the JSP. Struts is maintained as a part of Apache Jakarta project and is open
 
Beginner to advance guide to the Apache Struts
Beginner to advance guide to the Apache Struts The Complete Apache Struts Tutorial This complete reference of Jakarta Struts shows you how to develop Struts applications using ant and deploy on the JBoss Application Server. Ant script is provided
 
Developing Simple Struts Tiles Application
Developing Simple Struts Tiles Application Developing Simple Struts Tiles Application Introduction In this section I will show you how to develop simple Struts Tiles Application. You will learn how to setup the Struts Tiles and create example
 
Using tiles-defs.xml in Tiles Application
Using tiles-defs.xml in Tiles Application Using tiles-defs.xml in Tiles Application In the last section we studied how to forward the request (call) to a jsp page which specifies which tiles layout definition should be used to apply to the
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.