dev@jsftemplating.java.net

If component changes...

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Mon, 11 Sep 2006 15:32:30 -0700

I fixed the bug w/ the If component. This change has the potential to
effect other areas, particularly wrt to processing ${} or #{}
expressions. I don't think I broken anything, but if you see anything
funny, let me know.

Some details on how the If component works (skip if you're not interested):

The If component uses JSFTemplating to define its behavior. This is
mostly handled by the "if.xml" file. This file uses a LayoutIf
LayoutElement to process the condition to decide if it should render
child UIComponents. So when an "If" component is used in a page, say
page.jsf, you have:

* page.jsf:*
       ....
       <!if $attribute{a}|$attribute{b}>
          <some:component... >
          ...
       </if>
       ...

    *if.xml*
       ...
       <if condition="$property{condition}">
           // render child components
       </if>


    *LayoutIf.java*
        // Uses PermissionChecker.hasPermission() to evaluate the
"condition" property.

1) page.jsf sets "$attribute{a}|$attribute{b}" as its If component
condition (note: condition is implied by the syntax, this could be
written as <if condition="..."> also).

2) if.xml represents the If component, it sets its condition for as
$property{condition}.

3a) Before my bug fix, $property{} was stored during evalution of the
boolean equation as a String. This caused it to return "true" for any
non-null value.

3b) After my bug fix, $property{} is now evaluated before passing it to
the PermissionChecker... so the value of $property{} (or
$attribute{a}|$attribute{b}) is now evaluated. This is the expected
behavior.

You will need to rebuild the jsftemplating project to get this fix...

Ken