You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Gregor Melhorn <g....@web.de> on 2005/10/13 18:16:11 UTC

accessing enum from ognl

Hello tapestry users,

how do I reference an enum from an ognl value String inside a
component? I know it was on the list before, but the archives I read
removed the solution because the software thought it was an email
address...

Best regards
Gregor Melhorn



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


Re: accessing enum from ognl

Posted by Gregor Melhorn <g....@web.de>.
Thanks for posting it again...

Static access also works fine for me. In fact I simply forgot to
rebuilt my project, and was wondering for an hour why my ognl strings
didn't work...

Thanks anyway...

Gregor


> Geoff suggested a workaround with valueOf(...).
> Alexandr said enums work fine for him.
> It doesn't work for me, perhaps the problem is with accessing *inner*
> enums?

> Anyway, here it is:

> ------- Forwarded message -------
> From: "Alexandr Kundirenko" <ak...@gmail.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Subject: Re[2]: OGNL enum?
> Date: Wed, 05 Oct 2005 16:55:38 +0200

> Hi,

> Hmmm...
> I access enum like a constant and it works!

> public enum ReportType {
>          TOTALS,
>          COMPARISON
> }

> In Template:

> <span jwcid="@If"
>      condition="ognl:descriptor.mode eq  
> @com.myapp.report.ReportType@COMPARISON">

> Alex

GL>> This sucks but it works.

GL>> @package.Enum@valueOf("ONE")

GL>> Geoff

GL>> On 10/4/05, Martin Strand <ma...@entcap.biz> wrote:
>>>
>>> Is there a way to reference an enum with OGNL?
>>>
>>>
>>>
>>> package package;
>>>
>>> class Class
>>> {
>>> public enum Enum
>>> {
>>> ONE, TWO, THREE
>>> }
>>> }
>>>
>>>
>>>
>>> I tried a couple of variations but couldn't figure it out. Perhaps it's
>>> not possible?
>>> ognl:@package.Class.Enum@ONE ?
>>>
>>> -Martin
>>>

> On Thu, 13 Oct 2005 18:16:11 +0200, Gregor Melhorn <g....@web.de>
> wrote:

>> Hello tapestry users,
>>
>> how do I reference an enum from an ognl value String inside a
>> component? I know it was on the list before, but the archives I read
>> removed the solution because the software thought it was an email
>> address...
>>
>> Best regards
>> Gregor Melhorn

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




-- 
Mit freundlichen Grüßen
Gregor Melhorn
mailto:g.melhorn@web.de




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


Re: accessing enum from ognl

Posted by Martin Strand <ma...@entcap.biz>.
Geoff suggested a workaround with valueOf(...).
Alexandr said enums work fine for him.
It doesn't work for me, perhaps the problem is with accessing *inner*  
enums?

Anyway, here it is:

------- Forwarded message -------
From: "Alexandr Kundirenko" <ak...@gmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Subject: Re[2]: OGNL enum?
Date: Wed, 05 Oct 2005 16:55:38 +0200

Hi,

Hmmm...
I access enum like a constant and it works!

public enum ReportType {
         TOTALS,
         COMPARISON
}

In Template:

<span jwcid="@If"
     condition="ognl:descriptor.mode eq  
@com.myapp.report.ReportType@COMPARISON">

Alex

GL> This sucks but it works.

GL> @package.Enum@valueOf("ONE")

GL> Geoff

GL> On 10/4/05, Martin Strand <ma...@entcap.biz> wrote:
>>
>> Is there a way to reference an enum with OGNL?
>>
>>
>>
>> package package;
>>
>> class Class
>> {
>> public enum Enum
>> {
>> ONE, TWO, THREE
>> }
>> }
>>
>>
>>
>> I tried a couple of variations but couldn't figure it out. Perhaps it's
>> not possible?
>> ognl:@package.Class.Enum@ONE ?
>>
>> -Martin
>>

On Thu, 13 Oct 2005 18:16:11 +0200, Gregor Melhorn <g....@web.de>  
wrote:

> Hello tapestry users,
>
> how do I reference an enum from an ognl value String inside a
> component? I know it was on the list before, but the archives I read
> removed the solution because the software thought it was an email
> address...
>
> Best regards
> Gregor Melhorn

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