0

I'm trying to call a method (someMethod) of my managedBean but I got PropertyNotFoundException, I don't know why...

this is my backing bean:

@ManagedBean
@SuppressWarnings("serial")
public class CatBean implements Serializable{
    private String property1;
    private String property2;
    private String property3;

    public CatBean() {}

    //METHOD THAT I WANT TO CALL
    public String someMethod() throws Exception{
        System.out.println("EXAMPLE");      
        return "";
    }

    ... getters and setters 

}

This is my xhtml:

<h:form id="catBeanForm">
    <p:dialog id="dialogMessage">
        <h:outputText value="some text" />
    </p:dialog> 
    <p:panel header="Some header" style="width: 600px;">
        <h:panelGrid id="somePanel" columns="2">
        <h:outputText value="property1" />
        <p:inputText id="property1" value="#{catBean.property1}" maxlength="20" required="true">
             <f:validateRegex pattern="[a-zA-Z]+"/>
        </p:inputText>

        <h:outputText value="property2" />
        <p:inputText id="property2" value="#{catBean.property2}" maxlength="1000" required="true"/>

        <h:outputText value="property3" />
        <p:inputText id="property3" value="#{catBean.property3}" maxlength="2000"/>

        <p:spacer></p:spacer>
        <p:commandButton value="Click me" ajax="true" action="#{catBean.someMethod}" oncomplete="PF('dialogMessage').show()">
        </p:commandButton>  
        </h:panelGrid>
    </p:panel>
</h:form>

This is the error that I got:

javax.el.PropertyNotFoundException: The class 'com.bean.CatBean' does not have the property 'someMethod'.

What am I doing wrong?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Mariah
  • 1,073
  • 1
  • 14
  • 33

0 Answers0