If you use Spring, you can use a FieldRetrievingFactoryBean to expose your constants as beans.

http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/beans/factory/config/FieldRetrievingFactoryBean.html



Mike Kienenberger wrote:
More often than not, I use an accessor on the backing bean.

public String getSomeConstant()
{
   return SOME_CONSTANT;
}

#{someBean.someConstant}

On Tue, Nov 24, 2009 at 6:07 PM, laredotornado <[email protected]> wrote:
Hi,

I'm using MyFaces 1.1.6 and Tomahawk 1.1.9.  I have a public static final
int constant in a certain class, and I would like to be able to access that
value in my JSF page using JSF code.  I was curious what mechanisms you sue
to do that.

The only informative article I found on the subject is here --
http://java_rzanner.blogspot.com/2006/09/usage-of-constant-values-in-jsp-code.html,
which discusses creating a map of constants and putting them into the
application scope via a ServletContextListener.  If you know of a more
straightforward way, please let me know.

Thanks, - Dave

--
View this message in context: 
http://old.nabble.com/How-do-you-access-public-static-final-values-in-your-JSF-app--tp26504910p26504910.html
Sent from the MyFaces - Users mailing list archive at Nabble.com.





--
Daniel Barklon

Proship Entertainment, Inc.
Tel:514.485.8823 ext.224
Fax:514.485.2675
Web: http://www.proship.com
980 St. Antoine Street West, Suite #710
Montreal, Quebec, Canada H3C 1A8

Reply via email to