<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Once and Only Once : Accessing constants in JSF</title>
    <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Darren Tarbard's ramblings</description>
    <item>
      <title>Accessing constants in JSF</title>
      <description>

&lt;pre&gt;

marker interface:

package uk.co.tarbard.wfd;

public interface BackingPage {

}

custom property resolver:

package uk.co.tarbard.wfd;

import java.lang.reflect.Field;

import javax.faces.el.EvaluationException;
import javax.faces.el.PropertyNotFoundException;
import javax.faces.el.PropertyResolver;

public class ConstantPropertyResolver extends PropertyResolver {

	private PropertyResolver original;

	public ConstantPropertyResolver(PropertyResolver original) {
		this.original = original;
	}

	@Override
	public Class getType(Object arg0, int arg1) throws EvaluationException,
			PropertyNotFoundException {

		return original.getType(arg0, arg1);
	}

	@Override
	public Class getType(Object arg0, Object arg1) throws EvaluationException,
			PropertyNotFoundException {

		return original.getType(arg0, arg1);
	}

	@Override
	public Object getValue(Object arg0, int arg1) throws EvaluationException,
			PropertyNotFoundException {
		return original.getValue(arg0, arg1);
	}

	@Override
	public Object getValue(Object base, Object property)
			throws EvaluationException, PropertyNotFoundException {
		Object value = null;
		try {
			value = original.getValue(base, property);

		} catch (PropertyNotFoundException e) {

		}

		if (null != value) {
			return value;
		}
		if (null == base) {
			return null;
		}
		if (base instanceof BackingPage) {
			Field[] declaredFields = base.getClass().getDeclaredFields();
			for (int i = 0; i &lt; declaredFields.length; i++) {
				Field x = declaredFields[i];
				Object constantValue = null;
				if (property.equals(x.getName())){
					try {
						constantValue =  x.get(x);
					} catch (IllegalArgumentException e) {
						throw new PropertyNotFoundException("unable to access property " + property) ;
					} catch (IllegalAccessException e) {
						throw new PropertyNotFoundException("unable to access property " + property + " check that it is public") ;
					}
					return constantValue;
				}
				
			}
			throw new PropertyNotFoundException("unable to locate constant with name " + property + " perhaps you made a typo.");
		}

		return null;

	}

	@Override
	public boolean isReadOnly(Object arg0, int arg1)
			throws EvaluationException, PropertyNotFoundException {
		return original.isReadOnly(arg0, arg1);
	}

	@Override
	public boolean isReadOnly(Object arg0, Object arg1)
			throws EvaluationException, PropertyNotFoundException {
		return original.isReadOnly(arg0, arg1);
	}

	@Override
	public void setValue(Object arg0, int arg1, Object arg2)
			throws EvaluationException, PropertyNotFoundException {
		original.setValue(arg0, arg1, arg2);
	}

	@Override
	public void setValue(Object arg0, Object arg1, Object arg2)
			throws EvaluationException, PropertyNotFoundException {
		original.setValue(arg0, arg1, arg2);
	}

}

&lt;/pre&gt;
</description>
      <pubDate>Fri, 28 Aug 2009 00:11:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:150d3b00-7086-4b3f-9022-3bd281b8448c</guid>
      <author>Daz</author>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf</link>
      <category>software</category>
      <category>Software dev</category>
    </item>
    <item>
      <title>"Accessing constants in JSF" by steel building</title>
      <description>This is a great blog posting and very useful. I really appreciate the research you put into it.</description>
      <pubDate>Sat, 04 Feb 2012 05:54:27 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:e6e4a0dd-ad2d-4996-aa52-4f6dd65d35c5</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-16920</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by Essay Writing</title>
      <description>Sometimes it is really difficult to find such a useful and informative posts while searching on the internet. But after reading your article, now I will research more to find and collect such posts to enhance my knowledge.</description>
      <pubDate>Thu, 02 Feb 2012 11:22:14 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:5b5147a2-02e7-47ff-9bb7-c15fb70d5659</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-16900</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by Top Hair Salons NYC</title>
      <description>I was just looking for this information for some time. After 6 hours of continuous, finally I got it in your site. I wonder what is the lack of strategy from Google that do not classify this kind of informative sites at the top of the list</description>
      <pubDate>Mon, 30 Jan 2012 09:27:01 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:cb8a6b9c-0ac9-48fc-9de5-dacef5437b29</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-16844</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by Top Hair Salons NYC</title>
      <description>I was just looking for this information for some time. After 6 hours of continuous Googleing, finally I got it in your site. I wonder what is the lack of strategy from Google that do not classify this kind of informative sites at the top of the list</description>
      <pubDate>Mon, 30 Jan 2012 09:20:04 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:25f555d9-87cd-4d4a-bfbe-0c65708314ed</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-16843</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by Crate washing systems</title>
      <description>I am not usually motivated by informational articles, though your topic truly made me start thinking about your points of views. You have provided important and reliable opinions that happen to be rational and appealing. I privately care to comment on &lt;a href="http://europumps.com.au/tub_cleaning_systems" rel="nofollow"&gt;Crate washing systems&lt;/a&gt;
. And so I am conscious of the effort it requires forming an informational write-up like this. Thank you for conveying your advantageous work.
</description>
      <pubDate>Fri, 27 Jan 2012 00:57:21 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:0126bef0-8a01-4c31-9d6c-c7f8c75950c2</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-16825</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by boost immune system</title>
      <description>Hello, I would suggest you enhance the speed of your pages, it took me around 2 minutes here in loading &amp;hellip;</description>
      <pubDate>Tue, 17 Jan 2012 20:37:39 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:14dbee8e-dbd7-4d84-97be-7af911044071</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-16785</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by Cleveland Hotels Motels</title>
      <description>Hello,This is an informative blog post, Thanks a lot for the share.... I enjoyed it. Thanks!</description>
      <pubDate>Tue, 17 Jan 2012 06:04:05 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:6dd74d5f-575d-4c7f-a891-0cf38d2a6bf2</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-16776</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by Cleveland Hotels Motels</title>
      <description>Hello,This is an informative blog post, Thanks a lot for the share.... I enjoyed it. Thanks!</description>
      <pubDate>Tue, 17 Jan 2012 06:03:25 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:ff1fe913-70b4-4413-9291-a4c750739278</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-16775</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by Microsoft Office 2010</title>
      <description>Valuable information ..I am delighted to read this article..thank you for giving us this useful information. Great walk-through. I value this post.
</description>
      <pubDate>Mon, 09 Jan 2012 02:59:25 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:df1c8d89-4728-4786-99b5-5c61b8b3430c</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-16470</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by nike</title>
      <description>Hello, I truly enjoyed reading your post. I found your site from Bing. Will bookmark to return later. Thanks! &lt;a href="http://www.eurobookers.com/Destinations/Prague.aspx" rel="nofollow"&gt;City Breaks Prague&lt;/a&gt;. </description>
      <pubDate>Thu, 05 Jan 2012 11:57:45 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:1d3ed78b-2877-44ec-8475-320fab0b33ea</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-16435</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by Jordan 6</title>
      <description>forever lov you TMM,THANKS FOR ALL YOUR HELP FOR ME</description>
      <pubDate>Mon, 02 Jan 2012 07:47:57 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:ce77de7c-835b-4efa-aba4-f14ead72891c</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-16384</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by Selling My House Online</title>
      <description>Really great post .. Thank you for sharing this article knowledge.Excellently written, if only all bloggers offered the same level of content that you, the Internet would be a much better place. Please keep it up!

&lt;a href="http://www.house--buyer.co.uk/" rel="nofollow"&gt;Selling My House Online&lt;/a&gt;</description>
      <pubDate>Thu, 22 Dec 2011 11:26:22 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:3b62b077-b562-4e68-b09b-6a204fcad2a1</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-16079</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by insurance</title>
      <description>One of the most positive features that I have spotted out from your site is the real connection that you've built with your visitors. I really like the idea that your site is there to encourage people to do the best like investing on &lt;a href="http://www.thackeragency.com" rel="nofollow"&gt;insurance&lt;/a&gt;. Keep working.</description>
      <pubDate>Wed, 21 Dec 2011 10:38:11 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:adb12aaa-7405-464d-a404-f7f93cb99105</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-16047</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by cielle</title>
      <description>Interesting post. Very technical. You completed various good points here. Thanks!
__________________
&lt;a href="http://chiropractormelbourne.net/ " rel="nofollow"&gt;Chiropractor Melbourne&lt;/a&gt;  </description>
      <pubDate>Mon, 19 Dec 2011 15:57:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:12a045f9-8668-40b9-a3db-a7e3b009c8dd</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-15934</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by City breaks Rome</title>
      <description>Plan a City breaks Rome, is recommended for everyone and will be a special vacation for the entire family. Rome has something for everyone . You need to take some time for your breaks to include a few of the museums and other historical sites.Rome is one of Europe’s most beautiful cities and if you have not visited Italy, the capital is a great place to start your holidays.</description>
      <pubDate>Mon, 12 Dec 2011 13:52:17 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:6959e5e5-8241-4223-86dc-a8e637438255</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-15811</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by makeityourring diamond</title>
      <description>This is my first time i visit here. I found so many interesting stuff in your blog especially its discussion. From the tons of comments on your posts</description>
      <pubDate>Fri, 09 Dec 2011 08:54:49 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:fb7e1912-6f66-4770-a2da-09a7e54c477b</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-15735</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by Program Kasir</title>
      <description>This comment has been flagged for moderator approval. It won't appear on this blog until the author approves it.
&lt;a href="http://www.programkasir.org" rel="nofollow"&gt;Program Kasir&lt;/a&gt;</description>
      <pubDate>Thu, 08 Dec 2011 06:54:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:ab2e2f65-6402-4afb-b537-ecd66ff5da65</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-15603</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by Kevin60s</title>
      <description>I uncovered this blog as I was searching for a &lt;a href="http://www.levanta.com.au/car-hoists.php" rel="nofollow"&gt;2 post hoist&lt;/a&gt; document that was effective to check out. I compliment the operators as the information recommendations extremely helpful and handy. Thank you for making the net a much more instructional setting.</description>
      <pubDate>Thu, 08 Dec 2011 02:09:18 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:7b293f2a-cd69-4418-8637-8ba597298368</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-15596</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by &lt;a href="http://www.ozbuckets.com.au/rippers-head-brackets-hitches.php" rel="nofollow"&gt;Head bracket&lt;/a&gt;</title>
      <description>I think that this is definitely an excellent web page to encounter. I was seeking a &lt;a href="http://www.ozbuckets.com.au/rippers-head-brackets-hitches.php" rel="nofollow"&gt;Head bracket&lt;/a&gt; online when I somewhat arrived at this web site. I'll book mark this web page though for future guide. Great Day!!
</description>
      <pubDate>Thu, 08 Dec 2011 01:36:22 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:b3858b6d-a0f5-4c3a-829f-109130e076d0</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-15594</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by &lt;a href="http://www.ozbuckets.com.au/rippers-head-brackets-hitches.php" rel="nofollow"&gt;Head bracket&lt;/a&gt;</title>
      <description>I think that this is definitely an excellent web page to encounter. I was seeking a Head bracket online when I somewhat arrived at this web site. I'll book mark this web page though for future guide. Great Day!!
</description>
      <pubDate>Thu, 08 Dec 2011 01:35:52 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:a67d8379-ba5c-40a0-bc09-8c455efedddc</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-15593</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by louvre facade</title>
      <description>I suddenly discovered this excellent web site as I was investigating on louvre facade. I suppose this site is very useful. I so desire see new files as I return.</description>
      <pubDate>Wed, 07 Dec 2011 03:09:24 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:c7849f25-eb4e-4048-8b23-8e0f52590941</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-15556</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by unique content</title>
      <description>This post gives the light in which we can observe the reality. this is very nice one and gives in depth information. thanks for this nice article. Valuable information for all. I will recommend my friends to read this for sure.</description>
      <pubDate>Tue, 06 Dec 2011 20:15:25 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:d58fcf91-8f9d-4750-9c57-46bcaa1688fc</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-15553</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by City Breaks Paris </title>
      <description>This articles helps me more.Thanks for your sharing,I will pay more attentions to your blog. Looking forward to your better and better </description>
      <pubDate>Tue, 06 Dec 2011 11:40:18 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:0966678f-6ed8-48fc-977f-d21616f29fa2</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-15549</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by goodyear coupons</title>
      <description>I admire this post of yours. Thanks :) </description>
      <pubDate>Tue, 06 Dec 2011 08:46:50 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:8cf34df5-e3e0-46fb-8a07-740bb3d6b62f</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-15540</link>
    </item>
    <item>
      <title>"Accessing constants in JSF" by electric space heaters</title>
      <description>This comment has been flagged for moderator approval. It won't appear on this blog until the author approves it.</description>
      <pubDate>Tue, 06 Dec 2011 06:00:33 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:f00d30c0-7e63-421d-bbc0-57ba8dfc9117</guid>
      <link>http://www.tarbard.co.uk/articles/2009/08/28/accessing-constants-in-jsf#comment-15527</link>
    </item>
  </channel>
</rss>

