dev@jsftemplating.java.net

Re: JSFTemplating: <!include> and #include

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Fri, 11 Apr 2008 01:36:48 -0700

#include staticly includes a file into your page.

<!include> (or <ui:include> in the facelets syntax) dynamically includes
a file into your page. Also <!include> supports passing in parameters
to the included page. For example:

test.jsf:
    <!include src="foo.jsf" foo='bar' />

foo.jsf:
    "The value of foo: #{foo}

Try that.

The pro's for #include... from JSFT's perspective it is only 1 file and
therfor id's are never a problem. It's also fast and efficient (the
other way isn't bad, but this one is faster).

The pro's for <!include>, it's dynamic so you can use #{} to determine
the template name and you can pass in values. The big advantage comes
from the closely related tag: <!composition> which allows you to use
<!define> to pass values to a template. This is very powerful.

Let me know if you need more details.

Thanks,

Ken

Anissa Lam wrote:
>
> Hi Ken,
> I am not sure under when i should use <!include> or when I should
> use #include. Whats the pros or cons for each of this.
> Can you clarify ?
>
> thanks
> Anissa