Tvori
Tvori

Reputation: 298

Implicit expression language object "component" not working in jsf 2.2.6

I'm migrating a jsf 2.0 application to jsf 2.2.6. There is a extensive use of implicit EL object component as styleClass="#{component.valid?'':'err'}".

In jsf 2.2.6 (jsf-impl-2.2.6-jbossorg-4.jar) valid is not recognized, throwing "ServletException: The class 'javax.faces.component.html.xxx' does not have the property 'valid".

Is this functionality deprecated in jsf 2.x.x?

Can be related to JBoss EL?

Upvotes: 0

Views: 332

Answers (2)

Tvori
Tvori

Reputation: 298

Finally found the reason of the exception. The problem was that I had a comment in the code containing "component.valid". Removing the comment resolves the problem.

<!-- styleClass="#{component.valid ? '': 'err' }" -->

It's tricky. The exception was not clear about the line of code.

Upvotes: 0

Daniel
Daniel

Reputation: 37061

It seems that you trying the component.valid on element that does not support it at all, for example the h:panelGroup does not have the isValid getter , while h:inputText does.

A workaround could be to abuse the validation status of another element in your page in order to apply the styleClass of another, see example:

<h:panelGroup styleClass="#{myComponent.valid ? '' : 'error'}">
    <h:inputText id="input" value="#{myBean.myValue}" binding="#{myComponent}">
    </h:inputText>
</h:panelGroup >

Upvotes: 1

Related Questions