You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by James Hays <ja...@mac.com> on 2003/08/08 16:09:16 UTC

Using Boolean object in conditional component

Is there a way to use a Boolean object, rather than boolean, in a 
conditional component.

My attempt to use this resulted in an "Unable to parse expression error"

Here is the statement:
    <component id="isNew" type="Conditional">
        <binding name="condition" expression="visit.level.new"/>
    </component>

visit.level.new is of type Boolean


James


Re: Using Boolean object in conditional component

Posted by Amol Yadwadkar <ay...@webifyservices.com>.
Try this in your Html
<span jwcid="@Condition" condition="ognl:visit.level.new"/>
Hope It shall work.
best regds,
Amol
----- Original Message ----- 
From: "James Hays" <ja...@mac.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Friday, August 08, 2003 7:39 PM
Subject: Using Boolean object in conditional component


> Is there a way to use a Boolean object, rather than boolean, in a 
> conditional component.
> 
> My attempt to use this resulted in an "Unable to parse expression error"
> 
> Here is the statement:
>     <component id="isNew" type="Conditional">
>         <binding name="condition" expression="visit.level.new"/>
>     </component>
> 
> visit.level.new is of type Boolean
> 
> 
> James
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 

Re: Using Boolean object in conditional component

Posted by Harish Krishnaswamy <hk...@comcast.net>.
I am doing something like the following and it works fine.

<snip>
    <span jwcid="@Conditional" condition="ognl:readyForChart">
        <img jwcid="xyChart"/>
    </span>
</snip>

-Harish

James Hays wrote:

> Looks like in this case, expression won't take an ognl statement at 
> all.  It's looking directly for true or false.  Is this true?  What is 
> the reasoning for this?  How can I make this dynamic?
>
> James Hays wrote:
>
>> Is there a way to use a Boolean object, rather than boolean, in a 
>> conditional component.
>>
>> My attempt to use this resulted in an "Unable to parse expression error"
>>
>> Here is the statement:
>>    <component id="isNew" type="Conditional">
>>        <binding name="condition" expression="visit.level.new"/>
>>    </component>
>>
>> visit.level.new is of type Boolean
>>
>>
>> James
>>
>>
>> ---------------------------------------------------------------------
>> 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: Using Boolean object in conditional component

Posted by James Hays <ja...@mac.com>.
I recieved the same error with this statement as well.  It would 
probably work, but new is a keyword and caused me a bit of grief.

Harish Krishnaswamy wrote:

> Why can't you say expression="visit.level.new.booleanValue()"?
>
> -Harish
>
> James Hays wrote:
>
>> Looks like in this case, expression won't take an ognl statement at 
>> all.  It's looking directly for true or false.  Is this true?  What 
>> is the reasoning for this?  How can I make this dynamic?
>>
>> James Hays wrote:
>>
>>> Is there a way to use a Boolean object, rather than boolean, in a 
>>> conditional component.
>>>
>>> My attempt to use this resulted in an "Unable to parse expression 
>>> error"
>>>
>>> Here is the statement:
>>>    <component id="isNew" type="Conditional">
>>>        <binding name="condition" expression="visit.level.new"/>
>>>    </component>
>>>
>>> visit.level.new is of type Boolean
>>>
>>>
>>> James
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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: Using Boolean object in conditional component

Posted by Harish Krishnaswamy <hk...@comcast.net>.
Why can't you say expression="visit.level.new.booleanValue()"?

-Harish

James Hays wrote:

> Looks like in this case, expression won't take an ognl statement at 
> all.  It's looking directly for true or false.  Is this true?  What is 
> the reasoning for this?  How can I make this dynamic?
>
> James Hays wrote:
>
>> Is there a way to use a Boolean object, rather than boolean, in a 
>> conditional component.
>>
>> My attempt to use this resulted in an "Unable to parse expression error"
>>
>> Here is the statement:
>>    <component id="isNew" type="Conditional">
>>        <binding name="condition" expression="visit.level.new"/>
>>    </component>
>>
>> visit.level.new is of type Boolean
>>
>>
>> James
>>
>>
>> ---------------------------------------------------------------------
>> 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: Using Boolean object in conditional component

Posted by John Meredith <ps...@t-online.de>.
Ummm, sorry - if your @Conditional is in a component that is.

BTW, OGNL has the following to say about Booleans:

Interpreting Objects as Booleans
Any object can be used where a boolean is required. OGNL interprets
objects as booleans like this:

* If the object is a Boolean, its value is extracted and returned
* If the object is a Number, its double-precision floating-point value
is compared with zero; non-zero is treated as true, zero as false.
* If the object is a Character, its boolean value is true if and only if
its char value is non-zero.
        
Otherwise, its boolean value is true if and only if it is non-null.

Best regards,

  John

On Fri, 2003-08-08 at 16:35, John Meredith wrote:
> Hi James,
> 
> There's no getVisit() method in a component. Try:
> 
> <binding name="condition" expression="page.engine.visit.level.new"/>
> 
> or
> 
> <binding name="condition" expression="page.visit.level.new"/>
> 
> Hope this helps,
> 
>   John
> 
> On Fri, 2003-08-08 at 16:28, James Hays wrote:
> > Looks like in this case, expression won't take an ognl statement at 
> > all.  It's looking directly for true or false.  Is this true?  What is 
> > the reasoning for this?  How can I make this dynamic?
> > 
> > James Hays wrote:
> > 
> > > Is there a way to use a Boolean object, rather than boolean, in a 
> > > conditional component.
> > >
> > > My attempt to use this resulted in an "Unable to parse expression error"
> > >
> > > Here is the statement:
> > >    <component id="isNew" type="Conditional">
> > >        <binding name="condition" expression="visit.level.new"/>
> > >    </component>
> > >
> > > visit.level.new is of type Boolean
> > >
> > >
> > > James
> > >
> > >
> > > ---------------------------------------------------------------------
> > > 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
-- 
John Meredith <ps...@t-online.de>

Re: Using Boolean object in conditional component

Posted by John Meredith <ps...@t-online.de>.
Hi James,

There's no getVisit() method in a component. Try:

<binding name="condition" expression="page.engine.visit.level.new"/>

or

<binding name="condition" expression="page.visit.level.new"/>

Hope this helps,

  John

On Fri, 2003-08-08 at 16:28, James Hays wrote:
> Looks like in this case, expression won't take an ognl statement at 
> all.  It's looking directly for true or false.  Is this true?  What is 
> the reasoning for this?  How can I make this dynamic?
> 
> James Hays wrote:
> 
> > Is there a way to use a Boolean object, rather than boolean, in a 
> > conditional component.
> >
> > My attempt to use this resulted in an "Unable to parse expression error"
> >
> > Here is the statement:
> >    <component id="isNew" type="Conditional">
> >        <binding name="condition" expression="visit.level.new"/>
> >    </component>
> >
> > visit.level.new is of type Boolean
> >
> >
> > James
> >
> >
> > ---------------------------------------------------------------------
> > 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
-- 
John Meredith <ps...@t-online.de>

Re: Using Boolean object in conditional component

Posted by James Hays <ja...@mac.com>.
The problem is that new is a reserved word.  It works now.

Thanks all.

James Hays wrote:

> Looks like in this case, expression won't take an ognl statement at 
> all.  It's looking directly for true or false.  Is this true?  What is 
> the reasoning for this?  How can I make this dynamic?
>
> James Hays wrote:
>
>> Is there a way to use a Boolean object, rather than boolean, in a 
>> conditional component.
>>
>> My attempt to use this resulted in an "Unable to parse expression error"
>>
>> Here is the statement:
>>    <component id="isNew" type="Conditional">
>>        <binding name="condition" expression="visit.level.new"/>
>>    </component>
>>
>> visit.level.new is of type Boolean
>>
>>
>> James
>>
>>
>> ---------------------------------------------------------------------
>> 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: Using Boolean object in conditional component

Posted by James Hays <ja...@mac.com>.
Looks like in this case, expression won't take an ognl statement at 
all.  It's looking directly for true or false.  Is this true?  What is 
the reasoning for this?  How can I make this dynamic?

James Hays wrote:

> Is there a way to use a Boolean object, rather than boolean, in a 
> conditional component.
>
> My attempt to use this resulted in an "Unable to parse expression error"
>
> Here is the statement:
>    <component id="isNew" type="Conditional">
>        <binding name="condition" expression="visit.level.new"/>
>    </component>
>
> visit.level.new is of type Boolean
>
>
> James
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>