I am using a datatable created from a JPA entity.I need to add a column which will be filled with data from another entity, according to the value of the previous column. I could not map the entities as they are in different datasources.
My solution is:
<h:dataTable value="#{entity1ManagedBean.mydatalist}">
<h:column id="c1">
<f:facet name="header">
<h:outputText id="o1" value="Value1"></h:outputText>
</f:facet>
<h:outputText id="value1" value="#{temp.value1}"></h:outputText>
</h:column>
<h:column id="c2">
<f:facet name="header">
<h:outputText id="o2" value="Value2"></h:outputText>
</f:facet>
<h:outputText id="Value2" value="#{entity2ManagedBean.MapValuesMethod(temp.value1)}"></h:outputText>
</h:column>
but when i run it i get a javax.el.MethodNotFoundException: Method not found: class entity2ManagedBean.MapValuesMethod(java.lang.String)
When i remove the temp.value1
input from <h:outputText id="Value2" value="#{entity2ManagedBean.MapValuesMethod(temp.value1)}"></h:outputText>
and test my MapValuesMethod by setting a String input in the method, it works fine.
So i think the problem is i am not passing the temp.value1 string parameter to the managed bean method. Is this possible somehow?
EDIT:
JSF v2.2, eclipselink, web logic 12c
Managed Bean method:
public String getMapValuesMethod(String value1){
//value1= "some string" (testing method)
return sessionFacade.sessionBeanqueryMethod(value1);
}
and the session bean method is a simple query.
as I said, when I test the managed bean method by setting value1="some stringvalue" the method returns correct results from the session bean query.
Weblogic 12.2.1.2 supports EL 2.x.--> documentation (https://docs.oracle.com/middleware/1221/wls/NOTES/whatsnew.htm#NOTES558). I changed my ManagedBean function from public String MapValuesMethod(String value1)
to public String getMapValuesMethod(String value1)
and my .xhtml code from value="#{entity2ManagedBean.MapValuesMethod(temp.value1)}"
to value="#{entity2ManagedBean.getMapValuesMethod(temp.value1)}"
which solved the problem.