You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Howard Lewis Ship <hl...@gmail.com> on 2011/09/12 19:03:57 UTC

Re: @java.lang.Math@min inside TML files ?

On Sat, Sep 10, 2011 at 7:53 PM, Robert Zeigler
<ro...@roxanemy.com> wrote:
> T3-T4 used ognl for the binding/property expression language.  T5 does not (although there are third party add-ons that restore ognl use). T5's property expression language does not allow for static access, so @java.lang.Math@min won't work.
>

Generally, just write the method in the Java code and reference it
from the tml, i.e.:

.tml:

  You have at least ${min(1, remainingMinutes)} minutes before detonation]

.java

public int min(int op1, op2) { return Math.min(op1, op2); }


... though in practice, you might have more of the string generated in
Java code so that you can say "minute" vs. "minutes" dependency on the
cardinality.  In any case, the static method access in OGNL was useful
in T4 where templates were reloadable but classes were not. In T5 its
better to keep the templates simple by moving non-trivial logic to the
Java code.

> Robert
>
> On Sep 10, 2011, at 9/109:02 PM , Ken in Nashua wrote:
>
>>
>> Hi All,
>>
>> I am trying to operate
>> @java.lang.Math@min
>>
>> within my tml file and it is not working... the markup is spitting out code as opposed as executing the code for my logic.
>>
>> Has this usage of java inside markup files changed for tapestry ?
>> Best Regards and thanks
>> kcolassi@live.com
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

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