Tuesday, July 12, 2005

After a bit of effort I now have some basic JSF pages working.

One error that stumped me for a good while was the following

javax.faces.el.PropertyNotFoundException:
Can't instantiate class ....

This came about from a backing bean I was tryign to configure from my face-config.xml


<managed-bean-name> Menubar </managed-bean-name>
<managed-bean-class> com.aol.beans.jsf.Menubar </managed-bean-class>
<managed-bean-scope> application </managed-bean-scope>
<managed-property>
<description>List of items to appear in the MenuBar and privilages, these get localised to menu.</description>
<property-name>itemsAndPrivilegeLevel</property-name>
<property-class>java.lang.String[]</property-class>
<list-entries>
<value>home,1</value>
<value>profile,1</value>
<value>performance,1</value>
<value>transaction,1</value>
<value>reference,1</value>
<value>sysAdmin,3</value>
<value>production,2</value>
<value>logout,1</value>
</list-entries>
</managed-property>
</managed-bean>


Basically I was trying to set the itemsAndPrivilegeLevel parameter in the bean.

The problem was I hadn't created a getItemsAndPrivilegeLevel method in the bean. I dodn't think I needed one (I don't), but apparently either JSF or the beans specification think different, so I have to have that method there.

No comments: