dev@jsftemplating.java.net

question about 'if' handler

From: Anissa Lam <Anissa.Lam_at_Sun.COM>
Date: Sun, 22 Oct 2006 15:37:34 -0700

Hi Ken,
I have a question regarding how much processing is done by the 'if'
handler. I am not sure about the syntax, or whether this is possible
at all. Here is what i would like to do. I want to test if a page
session attribute exists or not, and use a default value if it
doesn't. Its ok if this can't be done, i will use the alternative
and go through a handler.

<!command
     if (* #{useId} = #{null}*) {
         println(value=" useId is not set. will use default");
     }
     if ( *!( #{useId}=#{null})* ) {
         println(value="useId has been set, the value is #{useId}");
     }
/>

alternative:

<!commond
      testExists( target="#{useId}" defined=>$attribute{defined});
      if (! #{defined}){
           println(value="useId is not set. will use default ");
       }
      if (#{defined}){
           println(value="useId is set, the value is #{useId}");
      }
/>