Eclipse errors on #{component.valid}: "valid cannot be resolved as a member of component”

前端 未结 1 1131
慢半拍i
慢半拍i 2021-01-20 16:55

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




        
相关标签:
1条回答
  • 2021-01-20 17:26

    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.

    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.

    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.

    0 讨论(0)
提交回复
热议问题