I have to work with some ids of some components in my backing bean so I've declared them as constants and I want to use them also in jsf (instead of hardcoding them there).
public final static String SMALL_PACKAGE_QUANTITY_OPT1 = "smallPackageQuantityOpt1";
Please note that I've added a getter for it, for jsf to be able to read this pr开发者_开发知识库operty:
public static String getSMALL_PACKAGE_QUANTITY_OPT1() {
return SMALL_PACKAGE_QUANTITY_OPT1;
}
and in jsf:
<ice:selectOneMenu id="#{vdcOrderBean.SMALL_PACKAGE_QUANTITY_OPT1}"
.../>
What is strange is that it says that it cannot find this property:
Property 'SMALL_PACKAGE_QUANTITY_OPT1' not found on type beans.VDCOrderBean
Do you guys see any issue in the code?
Thanks.
I think it's because of the static
keyword in front of the getter method. This makes the method part of the class and not of an instance of the class. A bean is an instance of a class so this method is not part of the bean.
TrueDub's suggestion is also a good one.
I suspect the capitalisation of the variable name might be a problem. Try changing the method name to getSmallPackageQuantityOpt1 and the JSF reference to #{vdcOrderBean.smallPackageQuantityOpt1}
Edit: not really relevant at all. Apologies
精彩评论