You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "squallmat ." <sq...@gmail.com> on 2014/08/22 18:08:05 UTC

if with context parameter

Hi,

I would like to know if is possible to put a method with a contextualized
value in it. For example :

<t:Loop t:source="chosenApplications" t:value="chosenApplication"
t:formstate="ITERATION">

     <t:if test="object.isItGood(${chosenApplication.getId()})">

     </t:if>
</t:Loop>


Is this possible ?

Re: if with context parameter

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Fri, 22 Aug 2014 13:08:05 -0300, squallmat . <sq...@gmail.com>  
wrote:

> Hi,

Hi!

> I would like to know if is possible to put a method with a contextualized
> value in it. For example :

Yes.

>      <t:if test="object.isItGood(${chosenApplication.getId()})">

Only the syntax is incorrect. Never, never, never ever use ${} expansions  
in component parameters. N-e-v-e-r. In 100% of the time, it's wrong or  
useless.

object.isItGood(chosenApplication.getId()) should work.  
object.isItGood(chosenApplication.id) too. But you should really think of  
moving the logic to the component or page class:

public boolean isItGood() {
	return object.isItGood(chosenApplication.getId());
}

<t:if test="itGood">...</t:if>

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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