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

I have the code below on the JSF page:

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

Eclipse generates an error in the component.valid part, as shown below:

valid cannot be resolved as a member of a component

How can i solve this?

+3
source share
1 answer

This is a known issue in versions of Eclipse older than Mars. Eclipse is not smart enough to determine that #{component} in this particular case actually refers to a subclass of UIInput and thinks incorrectly all the time that it is a UIComponent superclass that really does not have the isValid() property. You can just ignore it. This is a false mistake, and everything should work fine.

If you want to get rid of a false error and cannot go to Mars, go to Window> Preferences> Web> JavaServer Faces Tools> Test, expand problems like Coercion and set Unary logical coercion problems for Ignore.

enter image description here

A screenshot taken from this blog in all courtesy.

While you're on it, also do the same for Unary number sequence enforcement issues. This should prevent the same errors with the same type of EL operations on properties based on quantities that are not defined in the abstract superclass.

+2
source

Source: https://habr.com/ru/post/1213711/


All Articles