You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by david joffrin <da...@hotmail.com> on 2005/03/18 20:37:11 UTC

@Conditional

Hi,

I have a column that should only be displayed if the content is different 
than a certain value. Is it possible to possible to do something like that 
with @Conditional:
<span jwcid="@Conditional" condition="ognl:myObject.myMethod != 
@myObject.@myStaticVarriable">

Thanks.
DvJ



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


Re: @Conditional

Posted by Fermin Da Costa Gomez <da...@gmail.com>.
david joffrin wrote:
> Did not get any an answers? Could someone help please?
> 
>> Hi,
>>
>> I have a column that should only be displayed if the content is 
>> different than a certain value. Is it possible to possible to do 
>> something like that with @Conditional:
>> <span jwcid="@Conditional" condition="ognl:myObject.myMethod != 
>> @myObject.@myStaticVarriable">
Why don't you just make the comparison in the java code instead of using the 
above structure.
.page
condition="ognl:something"

.java
boolean isSomething(){...}

This wil certainly get you the desired result. At least it works for me.

Cheers

Fermin DCG
>>
>> Thanks.
>> DvJ
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


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


Re: @Conditional

Posted by Paul Ferraro <pm...@columbia.edu>.
Yes, but your syntax for referencing static variables is not correct.
if myObject is of type com.foo.MyObject, then the expression would look 
like:
myObject.myMethod != @com.foo.MyObject@myStaticVariable

See the ognl documentation for details:
http://www.ognl.org/2.6.7/Documentation/html/LanguageGuide/staticFields.html

Paul

david joffrin wrote:

> Did not get any an answers? Could someone help please?
>
>> Hi,
>>
>> I have a column that should only be displayed if the content is 
>> different than a certain value. Is it possible to possible to do 
>> something like that with @Conditional:
>> <span jwcid="@Conditional" condition="ognl:myObject.myMethod != 
>> @myObject.@myStaticVarriable">
>>
>> Thanks.
>> DvJ
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


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


Re: @Conditional

Posted by Mind Bridge <mi...@yahoo.com>.
Hi,

It is certainly possible. I can see a couple of issues with the OGNL
expression, however:

- if you want to call a method, rather than just invoke a getter for a
property, add the () at the end:
myObject.myMethod()

- when you access a static variable, make sure that you have written the
full path of the class and do not put a '.' before the '@' sign:
@com.mypackage.myObject@myStaticVariable

To sum it up:
condition="ognl: myObject.myMethod() !=
@com.mypackage.myObject@myStaticVariable"

Have a look at the OGNL site (http://www.ognl.org) for further details

I hope that helps :)

-mb

----- Original Message ----- 
From: "david joffrin" <da...@hotmail.com>
To: <ta...@jakarta.apache.org>
Sent: Saturday, March 19, 2005 9:42 PM
Subject: RE: @Conditional


> Did not get any an answers? Could someone help please?
>
> >Hi,
> >
> >I have a column that should only be displayed if the content is different
> >than a certain value. Is it possible to possible to do something like
that
> >with @Conditional:
> ><span jwcid="@Conditional" condition="ognl:myObject.myMethod !=
> >@myObject.@myStaticVarriable">
> >
> >Thanks.
> >DvJ
> >
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


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


Re: @Conditional

Posted by Steve Lianoglou <li...@binkabi.info>.
Yeah ... I don't see why that wouldn't work.

I'm also just a tapestry Newbie myself ... only problem I see is you 
static var access ... I'm prettu sure there's no (dot) after the class 
name.

a la:

<span jwcid="@Conditional" condition="ognl:myObject.myMethod != 
@MyClasst@myStaticVarriable">

or you might want to try

<span jwcid="@Conditional" condition="ognl:! myObject.myMethod == 
@MyClasst@myStaticVarriable">

take a whack at it a couple of ways .. one of those will work

-steve

On Mar 19, 2005, at 11:42 AM, david joffrin wrote:

> Did not get any an answers? Could someone help please?
>
>> Hi,
>>
>> I have a column that should only be displayed if the content is 
>> different than a certain value. Is it possible to possible to do 
>> something like that with @Conditional:
>> <span jwcid="@Conditional" condition="ognl:myObject.myMethod != 
>> @myObject.@myStaticVarriable">
>>
>> Thanks.
>> DvJ
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


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


AW: @Conditional

Posted by Gregor Melhorn <g....@web.de>.
Sorry, I did not get the answers on the topic before , and also it's wrong
because I overlooked the "static"... :-/

-----Ursprüngliche Nachricht-----
Von: tapestry-user-return-18418-g.melhorn=web.de@jakarta.apache.org
[mailto:tapestry-user-return-18418-g.melhorn=web.de@jakarta.apache.org] Im
Auftrag von Gregor Melhorn
Gesendet: Samstag, 19. März 2005 22:32
An: 'Tapestry users'
Betreff: AW: @Conditional

I think this question is OGNL-related, and so this is not part of tapestry,
but I think you can simply use

 condition="ognl:(myObject.myMethod) != myObject.myStaticVariable"

For further info look into the ognl documentation at ognl.org

Regards
Gregor

-----Ursprüngliche Nachricht-----
Von: tapestry-user-return-18402-g.melhorn=web.de@jakarta.apache.org
[mailto:tapestry-user-return-18402-g.melhorn=web.de@jakarta.apache.org] Im
Auftrag von david joffrin
Gesendet: Samstag, 19. März 2005 20:43
An: tapestry-user@jakarta.apache.org
Betreff: RE: @Conditional

Did not get any an answers? Could someone help please?

>Hi,
>
>I have a column that should only be displayed if the content is different 
>than a certain value. Is it possible to possible to do something like that 
>with @Conditional:
><span jwcid="@Conditional" condition="ognl:myObject.myMethod != 
>@myObject.@myStaticVarriable">
>
>Thanks.
>DvJ
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>



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




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




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


AW: @Conditional

Posted by Gregor Melhorn <g....@web.de>.
I think this question is OGNL-related, and so this is not part of tapestry,
but I think you can simply use

 condition="ognl:(myObject.myMethod) != myObject.myStaticVariable"

For further info look into the ognl documentation at ognl.org

Regards
Gregor

-----Ursprüngliche Nachricht-----
Von: tapestry-user-return-18402-g.melhorn=web.de@jakarta.apache.org
[mailto:tapestry-user-return-18402-g.melhorn=web.de@jakarta.apache.org] Im
Auftrag von david joffrin
Gesendet: Samstag, 19. März 2005 20:43
An: tapestry-user@jakarta.apache.org
Betreff: RE: @Conditional

Did not get any an answers? Could someone help please?

>Hi,
>
>I have a column that should only be displayed if the content is different 
>than a certain value. Is it possible to possible to do something like that 
>with @Conditional:
><span jwcid="@Conditional" condition="ognl:myObject.myMethod != 
>@myObject.@myStaticVarriable">
>
>Thanks.
>DvJ
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>



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




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


RE: @Conditional

Posted by Shawn Church <sh...@boxity.com>.
Yes, you can do that.  You may want to use .equals() however depending on
the type of objects you are comparing.  Your static variable should be fully
qualified, and it does not need the "." before the @.  For example
"@com.xxx.myObject@myStaticVariable".

<span jwcid="@Conditional" condition="ognl:
!myObject.myMethod.equals(@com.xxx.myObject@myStaticVariable)">

Sometimes for more complicated conditions it is cleaner to add a method in
your .java page code, rather than cluttering up your .html.  For example:

<span jwcid="@Conditional" condition="ognl:showColumn">

and then:

public boolean getShowColumn()
{
   return
getMyObject().getMyMethod().equals(getMyObject().myStaticVariable);
}


Shawn

-----Original Message-----
From: david joffrin [mailto:david_joffrin@hotmail.com]
Sent: Saturday, March 19, 2005 1:43 PM
To: tapestry-user@jakarta.apache.org
Subject: RE: @Conditional


Did not get any an answers? Could someone help please?

>Hi,
>
>I have a column that should only be displayed if the content is different
>than a certain value. Is it possible to possible to do something like that
>with @Conditional:
><span jwcid="@Conditional" condition="ognl:myObject.myMethod !=
>@myObject.@myStaticVarriable">
>
>Thanks.
>DvJ
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>



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


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


RE: @Conditional

Posted by david joffrin <da...@hotmail.com>.
Did not get any an answers? Could someone help please?

>Hi,
>
>I have a column that should only be displayed if the content is different 
>than a certain value. Is it possible to possible to do something like that 
>with @Conditional:
><span jwcid="@Conditional" condition="ognl:myObject.myMethod != 
>@myObject.@myStaticVarriable">
>
>Thanks.
>DvJ
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>



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