Today is my first time explore and implement Struts Tiles. Tiles is a templating technique that is very flexible and can be used with Struts or independently. Here is a good tutorial for Tiles to show u how good Tiles is for templatng.
Tiles is good, but the resources on Interrnet is quite misleading. In Tiles homepage at Apache, you will saw this:
"Tiles can be gathered dynamically during page reload. It is possible to change any attribute: layout, list of Tiles in portal, list of menu items, etc."
(it used the word "can" and this give me a impression that It can also be gathered statically as well.)
And in most tutorial (include the one I just recommend) use example of <%@ include file="mypage.jsp" %> to compare and contrast with Tiles.
These is very misleading, because what Tiles do is actually <jsp:include page="mypage.jsp"/>. It is dynamic include!!
As a result, I spend nearly a full day to make it work. This is because in dynamic include, JSP syntax in all file extension except .jsp will not be threat as JSP. So I had to map my .jspf to be parse as JSP.
The story do not just end here. Because it is dynamic include, so you need to include all the package and taglib in everypage that utilise it.
It is just 2 different compare to static include. But if you dont realise it is dynamic include, trial and error to get this 2 changes is a nightmare....
Of course, if you are more patient than me, you will find the tutorial had clearly stated that it is dynamic include. Perhaps it is my "quick start syndrome" make me miss out that line.
By the way, while configure your tiles-def.xml, there is some trick too. Will share this with you in coming post.