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 2009/02/10 12:14:06 UTC

T5: using an expression in t:if

Hi,

I'd like to display a count if count is greater than 200, but following will
trigger error:
Could not convert 'currentPage.count > 0' into a component parameter binding

<t:if test= 'currentPage.count > 200'>
  count : ${currentPage.count}
</t:if>

any idea? thanks,

Angelo
-- 
View this message in context: http://www.nabble.com/T5%3A-using-an-expression-in-t%3Aif-tp21931606p21931606.html
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: using an expression in t:if

Posted by Francois Armand <fa...@linagora.com>.
Angelo Chen wrote:
> Hi,
>
> I'd like to display a count if count is greater than 200, but following will
> trigger error:
> Could not convert 'currentPage.count > 0' into a component parameter binding
>
> <t:if test= 'currentPage.count > 200'>
>   count : ${currentPage.count}
> </t:if>
>   

This not supported in the T5.0-final version. You have three possibilites :
- do your logic in the java where it belongs ;
- use the Chenillekit  OGNL binding to gain access to OGNL syntax and 
possibilities ;
- wait for T5.1, one of the most visible upgrade being in the expression 
language.

-- 
Francois Armand
Etudes & Développements J2EE
Groupe Linagora - http://www.linagora.com
Tél.: +33 (0)1 58 18 68 28
-----------
http://fanf42.blogspot.com
InterLDAP - http://interldap.org 
FederID - http://www.federid.org/
Open Source identities management and federation


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


Re: T5: using an expression in t:if

Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, Feb 10, 2009 at 9:14 AM, Angelo Chen <an...@yahoo.com.hk> wrote:

> <t:if test= 'currentPage.count > 0'>

With the prop binding (the default), you can't use any expression like
that, just properties.
There are two ways to do what you want:

1) Create a getter in your page class (that's what I'd do):
public boolean isHasPages() {
    return pageCount > 200;
}

<t:if test= 'hasPages'>...</t:if>

2) Use the OGNL biding from
http://www.chenillekit.org/chenillekit-tapestry/ognlbinding.html.

-- 
Thiago

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