表达式错误:命名对象:找不到javax.faces.convert.IntegerConverter [英] Expression Error: Named Object: javax.faces.convert.IntegerConverter not found

查看:163
本文介绍了表达式错误:命名对象:找不到javax.faces.convert.IntegerConverter的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的代码

<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"为整数"值,"n.id"为字符串"值.我需要将String转换为Integer.我正在使用以下属性converter="javax.faces.convert.IntegerConverter",但出现错误.

"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.

表达错误:命名对象:找不到javax.faces.convert.IntegerConverter.

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

如何将转换器与<rich:select>一起使用?

How can I use converter with <rich:select>?

推荐答案

converter属性必须指向像#{bean.converter}这样的具体实例,或者包含带有转换器ID而不是标准转换器类名的字符串文字.如果您在标准转换器的 javadoc ,那么您将

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.

所以,这应该做:

<rich:select ... converter="javax.faces.Integer" />

这篇关于表达式错误:命名对象:找不到javax.faces.convert.IntegerConverter的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆