dev@jsftemplating.java.net

Re: How to use 'if'

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Mon, 04 Sep 2006 15:14:04 -0700

Hi Anissa,

I may support this the way you listed below, however, the support
doesn't exist right now. (FYI, the basic support for this in handlers
is there as handlers can be hierarchical and conditionally execute
"child" handlers... but the syntax is not robust enough to create this
use case.)

There is "if" support a the "(Layout)Component" level, however. This
allows you to make conditional areas of a page. Something like:

    <if $attribute{"version"}=EE>
        "This is the EE Version
    </if>
    <if !($attribute{"version"}=EE)>
        "This is the PE Version
    </if>

I'd like to expand this to support "else" and to expand this to
handlers... please file an enhancement request on issue tracker if you
can. In the mean time, I hope the above syntax will support what you need.

Thanks!

Ken

Anissa Lam wrote:
> Hi Ken,
>
> I want to know if 'if' is supported in jsftemplating. If so, can
> you show us the syntax on how to use it ?
>
> Specificially, i am looking for something like this:
>
> <event>
> <! beforeEncode
> *if ( $attribute{"version"} == "EE") *{
> println(value="this is EE version");
> } ???? Can i use else here ?
> *if ($attribute{"version"} != "EE") *{
> println(value=" This is NOT EE version");
> }
> />
> </event>
>
> thanks
> Anissa
>