#{component.valid}上的Eclipse错误:"valid无法解析为component的成员" [英] Eclipse errors on #{component.valid}: "valid cannot be resolved as a member of component”

查看:106
本文介绍了#{component.valid}上的Eclipse错误:"valid无法解析为component的成员"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在JSF页面中具有以下代码:

I've the below piece of code in a JSF page:

<p:inputText ...
    styleClass="labelledInput-input #{component.valid?'':'validation-failed'}"/>

Eclipse在component.valid部分产生错误,如下所示:

Eclipse produces an error on component.valid part as below:

有效无法解析为组件的成员

valid cannot be resolved as a member of component

我该如何解决?

推荐答案

这是早于Mars的Eclipse版本中的一个已知问题. Eclipse不够聪明,无法确定在这种特殊情况下#{component}实际上引用了UIInput子类,并且一直错误地认为它是UIComponent超类,而实际上它没有isValid()属性.您基本上可以忽略它.这是一个错误的错误,一切都应该正常工作.

This is a known issue in Eclipse versions older than Mars. Eclipse isn't smart enough to determine that #{component} in this particular case actually references UIInput subclass and incorrectly thinks all time that it's UIComponent superclass, which indeed doesn't have a isValid() property. You can basically just ignore'n'run it. It's a false error and everything should work just fine.

如果您想摆脱错误并不能升级到火星,请转到窗口>首选项> Web> JavaServer Faces工具>验证,展开类型强制问题并将一元运算布尔强制问题设置为忽略.

If you want to get rid of the false error and can't upgrade to Mars, then go to Window > Preferences > Web > JavaServer Faces Tools > Validation, unfold Type Coercion Problems and set Unary operation boolean coercion problems to Ignore.

此博客完全出于礼貌.

Screenshot borrowed from this blog in all courtesy.

在处理此问题时,也要对一元运算号强制问题执行相同的操作.这应该防止在基于类的数​​字上没有在抽象超类中定义的EL操作上出现相同的错误.

While you're at it, also do the same for Unary operation number coercion problems. This should prevent same errors on same kind of EL operations on number based properties not defined in the abstract superclass.

这篇关于#{component.valid}上的Eclipse错误:"valid无法解析为component的成员"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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