Expression Error: Named Object: javax.faces.convert.IntegerConverter not found

帅比萌擦擦* 提交于 2019-12-02 11:19:20

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!