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.

发表评论

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

WordPress.com 徽标

您正在使用您的 WordPress.com 账号评论。 登出 /  更改 )

Google photo

您正在使用您的 Google 账号评论。 登出 /  更改 )

Twitter picture

您正在使用您的 Twitter 账号评论。 登出 /  更改 )

Facebook photo

您正在使用您的 Facebook 账号评论。 登出 /  更改 )

Connecting to %s