On Fri, 11 Jan 2008 04:33:43 -0200, Ville Virtanen <[EMAIL PROTECTED]> 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(@[EMAIL PROTECTED])"> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to