我正在尝试调用managedBean的方法(someMethod),但我得到PropertyNotFoundException
,我不知道为什么......
这是我的支持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
}
这是我的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>
这是我得到的错误:
javax.el.PropertyNotFoundException:类'com.bean.CatBean'没有属性'someMethod'。
我做错了什么?