dev@jsftemplating.java.net

Re: JSFTemplating: Re: How to use 'if'

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Mon, 04 Sep 2006 16:17:45 -0700

Yes, I agree, it would be very convenient to do this.

Ken

Anissa Lam wrote:
> Hi Ken,
> I will file an enhancement request.
> But i do think that the ability to control if a handler should be
> called is really needed,
> In gui, there are lots of codes that depends the availability of 'if'
> to decide what to be called. eg
>
> <call name="createMBeanWithReferences" if="$attribute(isMBean)" />
> <call name="createResourceWithReferences" if="!$attribute(isMBean)" />
>
> If we can't do something equivalent to this, it will be major drawback
> from the jato framework.
>
> thanks
> Anissa.
>
> Ken Paulsen wrote:
>>
>> 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
>>>
>