0

I have the following composite component TestCC.xhtml:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:cc="http://java.sun.com/jsf/composite">
<cc:interface>
<cc:attribute name="manager" method-signature="java.lang.String helloTest()" required="true"/>
</cc:interface>
<cc:implementation>
Hello #{cc.attrs.manager} !!!!!!!!!!!!!!!!!!!!!
</cc:implementation>
</html>

When I try to call it in a JSFF file:

....
<icc:TestCC manager="#{viewScope.PatientClinicalBean.helloTest}"/>
...

The page crashes at my composite tag with the following message in the console:

javax.el.ELException: //C:/Documents and Settings/tlam/Application Data/JDeveloper/system11.1.2.3.39.62.76.1/o.j2ee/drs/iCHIP/ViewControllerWebApp.war/WEB-INF/classes/META-INF/resources/IchipComponent/TestCC.xhtml: javax.el.PropertyNotFoundException: //C:/Documents and Settings/tlam/Application Data/JDeveloper/system11.1.2.3.39.62.76.1/o.j2ee/drs/iCHIP/ViewControllerWebApp.war/Patient/Profile/Clinical.jsff @13,86 manager="#{viewScope.PatientClinicalBean.helloTest}": The class 'patient.profile.PatientClinicalBean' does not have the property 'helloTest'.

But my managed bean does have a public String helloTest() method, as well as other methods that work fine elsewhere in my JSFF page:

public class PatientClinicalBean{
String test = "TESTING"; 
...
public String helloTest() {
  return test;
}
...
}

I have tried this many times with different methods, all with the same result. Yet if my composite component outputs just a string and I enter the expression to access the String test field directly it executes properly. I can't seem to reference any of the methods in PatientClinicalBean from only my composite component, when other method calls work fine in the same JSFF page. All other examples I've seen on the web have no problems doing this the same way I have, am I missing something?!

1 Answers1

0

on jsf2, if you are calling a method, you need to add the parenthesis, like this:

....
<icc:TestCC manager="#{viewScope.PatientClinicalBean.helloTest()}"/>
...

otherwise jsf will interpret it as a field and will try find the method getHelloTest().

Heitor Ganzeli
  • 156
  • 1
  • 5