tiles — 3 types of resources

For Tiles, there’s some valuable but less-than-comprehensible code example at http://www.javaworld.com/javaworld/jw-09-2002/jw-0913-designpatterns.html

Background: U have a template file, containing variables, each naming a component-jsp file. Each variable is a place-holder to be substituted by the corresponding jsp.

Q: If you don’t know tiles, how would u do the substitution in a servlet container? How do you assign a header.jsp to the first variable? If first variable names “header.jsp” right within template.jsp , then we can’t reuse template.jsp in another project. We need template.jsp to be free of hard-coding.

A: You need some kind of glue-file. Tiles implents it as a set of definitions spelt out in tiles-defs.xml

Closest starting point: smarty — also contains template, variables holding large content. Smarty uses assign() to put the content into the variables and glue the parts.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s