似乎JSF尝试访问方法,就好像它是属性一样。
CollaborateursBean.java
public class CollaborateursBean implements Serializable {
....
public void ajouter(ActionEvent e)
{
System.out.println("DO SOMETHING");
}
}
page.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:t="http://myfaces.apache.org/tomahawk"
xmlns:mobe="http://steriamedshore.com/mobe">
<h:form id="FormAjoutCollaborateur">
<h:panelGrid columns="4" footerClass="subtitle"
headerClass="subtitlebig" styleClass="medium"
columnClasses="subtitle,medium" align="center"
>
<f:facet name="header"
>
<h:outputText value="Ajouter un utilisateur" />
</f:facet>
<h:outputText value="#{collaborateursBean.initialize()}"/>
<h:outputText value="Matricule" />
<h:inputText id="matricule" value="#{collaborateursBean.helper.ajoutcollaborateurvo.matricule}" />
<f:facet name="footer">
<h:commandButton id="enregistrer" value="Enregistrer"
actionListener="#{collaborateursBean.ajouter}">
</h:commandButton>
<h:commandButton id="annuler" value="Annuler" action="utilisateurs">
</h:commandButton>
</f:facet>
</h:panelGrid>
</h:form>
</ui:composition>
这是启动Tomcat时遇到的异常:
**Property 'ajouter' not found on type com.steriamedshore.proboard.view.referentiel.collaborateurs.CollaborateursBean
viewId=/view/pages/protected/maintenance/utilisateurs.xhtml
location=D:\DEV\workspaces\pro-board\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\proboard-web\view\pages\protected\maintenance\utilisateurs.xhtml
phaseId=RENDER_RESPONSE(6)
Caused by:
javax.el.PropertyNotFoundException - Property 'ajouter' not found on type com.steriamedshore.proboard.view.referentiel.collaborateurs.CollaborateursBean
at javax.el.BeanELResolver$BeanProperties.get(BeanELResolver.java:237)**
这是如何引起的?如何解决?