You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Ville Virtanen <vi...@hotmail.com> on 2008/01/11 07:33:43 UTC

T5 : if component help

Hi all,
 
I need to test if a property in my page equals a value from static constant class. I have no clue if this can be done. I mean something like:<t:if test="selectedSubMenu.equals(@com.example.something.admin.SubMenuConstants@OBJECTS)">
 
I'm currently learning to do things after T4. (Hence the ognl in equals clause, which im not sure is even relevant to T5, is it still using ognl under the hood?)
 
This is something I desperately need answer to. (Or then I must rethink some portions of the software...)
 
Thanks,
 
Ville
_________________________________________________________________
Lataa 30 ILMAISTA hymiötä Windows Live Messengeriisi!
http://www.livemessenger-emoticons.com/fi-fi

RE: T5 : if component help

Posted by Ville Virtanen <vi...@hotmail.com>.
Hi, I too miss ognl, but your point is very good. At first this new way seems limited, but I agree that testability makes for it.
 
(And one could argue that you dont have to learn yet another language to implement your logic.)
 
Also, refactoring is a bit easier again.
 
Thanks,
 
 - Ville



> Date: Fri, 11 Jan 2008 11:26:34 -0200> To: users@tapestry.apache.org> Subject: Re: T5 : if component help> From: thiagohp@gmail.com> > On Fri, 11 Jan 2008 04:33:43 -0200, Ville Virtanen > <vi...@hotmail.com> wrote:> > > Hi all,> > I need to test if a property in my page equals a value from static > > constant class. I have no clue if this can be done. I mean something > > like:<t:if > > test="selectedSubMenu.equals(@com.example.something.admin.SubMenuConstants@OBJECTS)">> > I'm currently learning to do things after T4. (Hence the ognl in equals > > clause, which im not sure is even relevant to T5, is it still using ognl > > under the hood?)> > T5, by default, does not use OGNL. It uses something very similar to the > prop binding in T4. So move your logic to a method that returns a boolean > value and use this in your template:> > public boolean isObjectsMenu() {> return > selectedSubMenu.equals(com.example.something.admin.SubMenuConstants.OBJECTS);> }> > <t:if test="objectsMenu">> > Coming from T4, at first I missed the power of OGNL, but then I realized > that moving all logic to the page class makes it more easily testable and > debuggable. ;)> > -- > Thiago H. de Paula Figueiredo> Desenvolvedor, Instrutor e Consultor de Tecnologia> Eteg Tecnologia da Informação Ltda.> http://www.eteg.com.br> > ---------------------------------------------------------------------> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org> For additional commands, e-mail: users-help@tapestry.apache.org> 
_________________________________________________________________
Windows Vista + Windows Live. Astu digitaaliseen maailmaan.
http://get.live.com

Re: T5 : if component help

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Fri, 11 Jan 2008 04:33:43 -0200, Ville Virtanen  
<vi...@hotmail.com> wrote:

> Hi all,
> I need to test if a property in my page equals a value from static  
> constant class. I have no clue if this can be done. I mean something  
> like:<t:if  
> test="selectedSubMenu.equals(@com.example.something.admin.SubMenuConstants@OBJECTS)">
> I'm currently learning to do things after T4. (Hence the ognl in equals  
> clause, which im not sure is even relevant to T5, is it still using ognl  
> under the hood?)

T5, by default, does not use OGNL. It uses something very similar to the  
prop binding in T4. So move your logic to a method that returns a boolean  
value and use this in your template:

public boolean isObjectsMenu() {
	return  
selectedSubMenu.equals(com.example.something.admin.SubMenuConstants.OBJECTS);
}

<t:if test="objectsMenu">

Coming from T4, at first I missed the power of OGNL, but then I realized  
that moving all logic to the page class makes it more easily testable and  
debuggable. ;)

-- 
Thiago H. de Paula Figueiredo
Desenvolvedor, Instrutor e Consultor de Tecnologia
Eteg Tecnologia da Informação Ltda.
http://www.eteg.com.br

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