You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Angelo Chen <an...@yahoo.com.hk> on 2007/08/28 12:50:05 UTC

T5:If component

Hi,
how to use the component IF? I have this in the page class:
   private String getLoginned() {
        return "true";
    }

then I want to refer to it from the html:
 <t:if test="${loginned}='true'">  
  </t:if>

this will always cause an error that: does not contain a property named
'loginned' 
-- 
View this message in context: http://www.nabble.com/T5%3AIf-component-tf4341030.html#a12365775
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5:If component

Posted by Nick Westgate <ni...@key-planning.co.jp>.
Or, since that's not always convenient for your html:

<t:if test="loggedin">
...
</t:if>
...
<t:if test="loggedin" negate="true">
...
</t:if>

Cheers,
Nick.


Robin Helgelin wrote:
> On 8/28/07, Angelo Chen <an...@yahoo.com.hk> wrote:
>> Thanks, this works! i check the doc, seems there is no 'else' in this
>> component like T4, right?
> 
> It works like this:
> 
> <t:if test="loggedin">
>     <t:parameter name="else">
>         Not logged in!
>     </t:parameter>
> </t:if>
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5:If component

Posted by Robin Helgelin <lo...@gmail.com>.
On 8/28/07, Angelo Chen <an...@yahoo.com.hk> wrote:
>
> Thanks, this works! i check the doc, seems there is no 'else' in this
> component like T4, right?

It works like this:

<t:if test="loggedin">
    <t:parameter name="else">
        Not logged in!
    </t:parameter>
</t:if>

-- 
        regards,
        Robin

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5:If component

Posted by Angelo Chen <an...@yahoo.com.hk>.
Thanks, this works! i check the doc, seems there is no 'else' in this
component like T4, right?


Nick Westgate wrote:
> 
> The If component's test parameter is a boolean:
> http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html
> 
> 

-- 
View this message in context: http://www.nabble.com/T5%3AIf-component-tf4341030.html#a12366131
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5:If component

Posted by Nick Westgate <ni...@key-planning.co.jp>.
The If component's test parameter is a boolean:
http://tapestry.apache.org/tapestry5/tapestry-core/component-parameters.html

You need to make your accessor non-private:
     public boolean getLoginned() {
          return true;
      }

And the default binding is prop, so no funky OGNL-like stuff:
   <t:if test="loginned">
    </t:if>

Cheers,
Nick.


Angelo Chen wrote:
> Hi,
> how to use the component IF? I have this in the page class:
>    private String getLoginned() {
>         return "true";
>     }
> 
> then I want to refer to it from the html:
>  <t:if test="${loginned}='true'">  
>   </t:if>
> 
> this will always cause an error that: does not contain a property named
> 'loginned' 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org