Jeff, Even if you provide an accessor method to access the static field, will it really help as I want to then use this accessor method as a key to the map - which the EL will not allow me to. #{someManagedBean.addresses[<here goes the accessor method>].city} - this will not yield anything.
I guess that is a limitation of EL in its present state. > -----Original Message----- > From: Jeff Bischoff [mailto:[EMAIL PROTECTED] > Sent: Friday, December 01, 2006 9:37 PM > To: MyFaces Discussion > Subject: Re: accessing static fields and methods via EL > > 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*** >