Changes for page Basic Tiles Integration

Last modified by Ken McWilliams on 2012/03/20 22:49

From version Icon 6.1 Icon
edited by Ken McWilliams
on 2012/03/18 23:50
Change comment: There is no comment for this version
To version Icon 6.2 Icon
edited by Ken McWilliams
on 2012/03/20 23:24
Change comment: There is no comment for this version

Summary

Details

Icon Page properties
Content
... ... @@ -2,22 +2,22 @@
2 2  
3 3  This is background for people new to templates. If you know you want to integrate tiles skip to the heading **Adding Tiles to your Struts2 Project**.
4 4  
5 -If you are here you are aware of the problem: Web pages share a lot of commonality. Being Java programmers we are well versed in the problems of code duplication (because object oriented programming has excelent tools to combat this issue we are ever vigilent), simply it makes reuse and maintinence difficult. Two tools we use without hardly a thought in our Object Oriented arsenal is Composition and Inherietance.
5 +If you are here you are aware of the problem: Web pages share a lot of commonality. Being Java programmers we are well versed in the problems of code duplication (because Object Oriented Programming has excellent tools to combat this issue we are ever vigilent.) Simply, it makes reuse and maintenance difficult. Two tools we use without hardly a thought in our Object Oriented arsenal is Composition and Inheritance.
6 6  
7 7  Think then of a Template as an Object, which has as its properties a body and values which are inserted into that body.
8 8  
9 -If we want to reuse a template it would be nice to say: I would like to create an new template exactly like my other template, but I want to override part of it with anther implementation (that is I want to substitute the body portion with other data). If so, tiles is for you!
9 +If we want to reuse a template, it would be nice to say: I would like to create a new template exactly like my other template, but I want to override part of it with another implementation (that is I want to substitute the body portion with other data). If so, tiles is for you!
10 10  
11 -So we can think of a template as being like a Java Object. We can use composition to group templates together for complicated page layout and we can use inheritance to reuse a template by changing just the portions we want to suit our needs.
11 +So we can think of a template as being like a Java Object. We can use composition to group templates together for complicated page layout and we can use inheritance to reuse a template by changing just the portions we want to suit our needs.
12 12  
13 13  In this way we can remove all the code duplication.
14 14  
15 -With Apache Tiles we reap the following benifits (I'm assuming JSPs as the view but Freemarker and Velocity are also supported, although you may need to upgrade to tiles 2.2.2 which is the subject of another tutorial):
15 +With Apache Tiles we reap the following benefits (I'm assuming JSPs as the view but Freemarker and Velocity are also supported, although you may need to upgrade to tiles 2.2.2 which is the subject of another tutorial):
16 16  
17 -* JSPs reflect only relevant content. For instance it is a lot easier to understand a page which just conserns the body content than trying to understand a page marked up for both content and presentation and vice versa it is a lot easer to understand a template that is not loaded with content.
18 -* It is easy to create tempates in parts. ie: You can have a template to layout the head(html head element - to bring in required java script and css resources), page header, menu, body and footer. Then you can have several templates specifically for each of the previous components.
19 -* Increases the separation beween designers and programmers. There should be more separation between JSPs which aquire and display data and JSPs which act as templates, the later of which the designers are more interested in.
20 -* Tiles xml provides a souce from which all template definitions can be viewed at once (this is the main strength over JPS includes and will be expanded upon in the next section).
17 +* JSPs reflect only relevant content. For instance, it is a lot easier to understand a page which just concerns the body content than trying to understand a page marked up for both content and presentation and vice versa it is a lot easier to understand a template that is not loaded with content.
18 +* It is easy to create templates in parts. ie: You can have a template to layout the head (html head element - to bring in required java script and css resources), page header, menu, body and footer. Then you can have several templates specifically for each of the previous components.
19 +* Increases the separation between designers and programmers. There should be more separation between JSPs which acquire and display data and JSPs which act as templates, the later of which the designers are more interested in.
20 +* Tiles xml provides a source from which all template definitions can be viewed at once (this is the main strength over JPS includes and will be expanded upon in the next section).
21 21  
22 22  == Apache Tiles vs SiteMesh vs JSP includes ==
23 23