问题
Following is my code
<rich:select id="cycle_group" value="#{menuCycleBean.menuCycleDetailTO.menuCycleGroupId}" defaultLabel="#{msg['gobal.select.default.label']}"
converter="javax.faces.convert.IntegerConverter">
<f:selectItems value="#{menuCycleBean.cycleGroupList}" var="n" itemLabel="#{n.label}" itemValue="#{n.id}" />
</rich:select>
"menuCycleGroupId" is "Integer" Value and "n.id" is "String" value. I need to convert String to Integer. I am using following attribute converter="javax.faces.convert.IntegerConverter"
, but it is giving error.
Expression Error: Named Object: javax.faces.convert.IntegerConverter not found.
How can I use converter with <rich:select>
?
回答1:
The converter
attribute must point to either a concrete instance like #{bean.converter}
or contain a string literal with the converter ID and not the fully qualified converter class name. If you click through CONVERTER_ID
field constant in the standard converter's javadoc, then you'll find out that it's javax.faces.Integer
for the IntegerConverter
.
So, this should do:
<rich:select ... converter="javax.faces.Integer" />
来源:https://stackoverflow.com/questions/10766349/expression-error-named-object-javax-faces-convert-integerconverter-not-found