Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Expression language change with primefaces 5.2

With primefaces 5.1 it was no problem to refer only a getter in a managed bean like

<ui:param name="curSearch" value="#{searchBL.getSelectedSearch()}" />

Changed to primefaces 5.2.2 I have to do

<ui:param name="curSearch" value="#{searchBL.selectedSearch}" />

and provide a getter and a setter. Why?

Exception:

09:35:29,178 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http-/0.0.0.0:9090-6) Error Rendering View[/views/main.xhtml]: javax.el.ELException: /sections/search/searchOptions.xhtml @23,111 value="#{curSearch.sortPropertyName}": /sections/search/firstSearchTab.xhtml @44,53 value="#{curSearch}": /sections/searchMaskContent.xhtml @38,74 value="#{searchBL.getSelectedSearch()}": Cannot find method 'getSelectedSearch' in 'class SearchBL$Proxy$_$$_WeldClientProxy'
at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:103) [jsf-impl-2.2.10.jar:2.2.10]
at org.primefaces.el.ValueExpressionAnalyzer.intercept(ValueExpressionAnalyzer.java:69) [primefaces-5.2.2.jar:5.2.2]
at org.primefaces.el.ValueExpressionAnalyzer.getReference(ValueExpressionAnalyzer.java:27) [primefaces-5.2.2.jar:5.2.2]
at org.primefaces.metadata.BeanValidationMetadataExtractor.extractPropertyDescriptor(BeanValidationMetadataExtractor.java:64) [primefaces-5.2.2.jar:5.2.2]
at org.primefaces.metadata.BeanValidationMetadataExtractor.extractConstraintDescriptors(BeanValidationMetadataExtractor.java:51) [primefaces-5.2.2.jar:5.2.2]
at org.primefaces.metadata.BeanValidationMetadataExtractor.extractDefaultConstraintDescriptors(BeanValidationMetadataExtractor.java:46) [primefaces-5.2.2.jar:5.2.2]
at org.primefaces.component.outputlabel.OutputLabelRenderer.isNotNullDefined(OutputLabelRenderer.java:139) [primefaces-5.2.2.jar:5.2.2]
at org.primefaces.component.outputlabel.OutputLabelRenderer.encodeEnd(OutputLabelRenderer.java:121) [primefaces-5.2.2.jar:5.2.2]
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:919) [jsf-api-2.2.10.jar:2.2]
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312) [jsf-impl-2.2.10.jar:2.2.10]
at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:114) [jsf-impl-2.2.10.jar:2.2.10]

I use JUEL EL, perhaps this is the problem?

like image 346
opfau Avatar asked Nov 10 '22 14:11

opfau


1 Answers

Based on the stack trace, you've a <p:outputLabel indicateRequired="true"> which would like to check if any @NotNull is defined on the associated bean property. PrimeFaces is using its homegrown org.primefaces.el.ValueExpressionAnalyzer for that which will breakdown the EL expression representing the value of the input component associated with the label component.

However, in 5.2 it was changed as compared to 5.1 as result of fix for issue 8093 of failing EL inspection on null nested properties. Now it doesn't distinguish method expressions anymore. Your best bet is reporting an issue to PrimeFaces guys and tell them to peek at OmniFaces org.omnifaces.el.ExpressionInspector how to do the EL expression analyzing job the right way.

Nonetheless, it's kind of strange that you're referring a readonly value as value of a required input component.

like image 154
BalusC Avatar answered Nov 15 '22 13:11

BalusC