Greg Reddin <[EMAIL PROTECTED]> wrote: One thing that has often bothered me
about Tiles in a standalone web
application is the need for a JSP page that "calls" a tiles
definition. Consider the following from the Tiles 2.0 test application:
tiles-defs.xml
In this case you have a tile called "doc.mainLayout". In most cases
you want to have a URL that pulls in the doc.mainLayout and replaces
the "body" component with something else. Right now you have to
create an intermediate JSP page:
intermediate.jsp
If you're using Tiles with Struts you can use the forward mechanism
to achieve this without the intermediate JSP page:
But you essentially have to do the intermediate page in tiles-defs.xml:
In JSF you have a similar issue. I haven't used Tiles with JSF yet,
but I think you could do the same thing you do with Struts. You just
use navigation-rules instead of action mappings. I'm currently
building an app using JSF and Facelets. Facelets gets around the
"intermediate" page by being sort of a "backwards" Tiles - or more
precisely - an "inline" Tiles. In Facelets you extend things
inline. Here's an example:
With Tiles you might have a template that does this:
In the above code your template invokes named "sections" that are
defined in the tile definition. You invoke the template and
substitute values for the named section.
To do the same thing in Facelets you might have this:
Default Header Stuff
Default Body Stuff
Default Footer Stuff
Then you extend it with a page like this:
Extended/Overridden Body Content
JSF removes the intermediate step b/c the FacesServlet will always
render a view - so if you hit the URL myapp/somepage.jsf you'll get
forwarded to /somepage.xhtml which can invoke a template. So you can
see how Facelets sort of works backwards. You define a page that
extends a template and defines the extended portions inline. If
Facelets was supported in a standalone environment (i.e. without
JSF) you could possibly just invoke a *.xhtml URL and skip the
intermediate step altogether.
It would be nice if we could make Tiles work this way. Then you'd
have a Facelets-like templating technology that is based on JSP and
works the same in JSF, Struts, any other MVC framework in which it is
supported, and standalone without any MVC framework whatsoever.
Thoughts?
Greg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Facelets is a good framework for JSF presentation. It follows JSF lifecycle
(but JSP does not) but it has shortcommings yet. It is not as mature as JSP (no
support for i18n, very restricted set of tags to name a few) but it will not
remain so. I think it is a good idea to add "inline Tiles" feature to Tiles for
now.
---------------------------------
Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small
Business.