myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Bischoff <jbisch...@klkurz.com>
Subject Re: accessing static fields and methods via EL
Date Fri, 01 Dec 2006 16:06:34 GMT
Madhav,

Well generally I make an accessor method in my managed bean when I need 
to provide EL access to static fields like this. However, I have not 
tried using this in combination with a Map, so I don't know if that will 
complicate things for you.

Regards,

Jeff Bischoff
Kenneth L Kurz & Associates, Inc.

Madhav Bhargava wrote:
> Hi All,
> 
> 
> 
> 
> As per the documentation EL in its current form does not support access
> to static fields and methods. I have a scenario for static field usage:
> 
> 
> 
> 
> I have the following Map:
> 
> Key - SomeClass.PUBLIC_STATIC_CONSTANT
> 
> Value - Object
> 
> 
> 
> 
> Let us take an example:
> 
> 
> 
> 
> Address class -
> 
> 
> 2 public static constants are declared:
> 
> 
> 
> 
> 1. public static final String PRIMARY_ADDRESS = "primary_address";
> 
> 2. public static final String SECONDARY_ADDRESS = "secondary_address";
> 
> 
> 
> 
> For a person a Map is maintained containing addresses. The key for this
> map is either of the constants mentioned above. I could only find one
> way to access the city attribute of a primary address:
> 
> #{someManagedBean.addresses['primary_address'].city} - I had to provide
> the value stored against the constant field - which means hard coding,
> which in all means I wanted to avoid.
> 
> 
> 
> 
> I encountered a sourceforge project which extends the current EL -
> http://el-functors.sourceforge.net/
> 
> 
> 
> 
> 
> Are there plans to make this an integral part of EL?
> 
> 
> 
> 
> Regards,
> 
> madhav
> 
> 
> 
> **************** CAUTION - Disclaimer *****************
> This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the
use of the addressee(s). If you are not the intended recipient, please notify the sender by
e-mail and delete the original message. Further, you are not to copy, disclose, or distribute
this e-mail or its contents to any other person and any such actions are unlawful. This e-mail
may contain viruses. Infosys has taken every reasonable precaution to minimize this risk,
but is not liable for any damage you may sustain as a result of any virus in this e-mail.
You should carry out your own virus checks before opening the e-mail or attachment. Infosys
reserves the right to monitor and review the content of all messages sent to or from this
e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys
e-mail system.
> ***INFOSYS******** End of Disclaimer ********INFOSYS***



Mime
View raw message