Wednesday, January 22, 2014

Spring Course: V114 - 118 Apache Tiles and Spring MVC

Apache Tiles is a way to build your web page out of different components (e.g. footer, header, side page, main page)

Another library that you can use is Sitemesh

Video 114: The Dependencies
in this video we just added the required dependencies

Video 115: HelloWord

1- before, we were using jspViewResolver now we will use tilesViewResolver.

as you can see we use TilesViewResolver bean for resolving the view.

 the TilesConfigurer bean is basically a bean which takes a list of xml files where we define the layout of our pages, we defined one layout for now which is default.xml

2- define the layout.

defining the layout is basically a Tile thing.

3- sure, create default.jsp

Video 116: Adding Header & Footer
in this tutorial we will see how to add header and footer

1- in the layout xml file (default.xml) in our case
as you can see you define the header, footer as attributes,

2- create the pages mentioned above, header.jsp, content.jsp, footer.jsp

3- use the attributes:

as you can see, firstly add the taglib, then use tiels:insertAttribute

Video 117: Formatting the Offers Application
here we are just adding css files to make pages little nicer

Video 118: Creating Tiles from JSP files
we convert all the jsp files to tiles style

one thing here about Tiles:

as you can see we are defining new definition with extends, so you don't have to redefine your attributes for each page.


No comments:

Post a Comment