[JSF]Probleme de methode non trouvé
Impossible de faire fonctionner les action (commandButton) a chaque fois, il ne trouve pas une des methode si je l'ai enleve c'en est un autre qui ne trouve pas , j'ai :
Code:
1 2 3 4 5 6 7
|
ERROR] InvokeApplicationPhase - #{document.ajouter}: javax.faces.el.MethodNotFoundException: ajouter <javax.faces.FacesException: #{document.ajouter}: javax.faces.el.MethodNotFoundException: ajouter>javax.faces.FacesException: #{document.ajouter}: javax.faces.el.MethodNotFoundException: ajouter
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
..... |
Extrait de la jsp
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| <f:view>
<h:form>
<h:outputText value="#{document.nbEnr}"/>
<h:commandButton value="<" action="#{document.prevPage}"/>
<h:commandButton value=">" action="#{document.nextPage}"/>
<h:dataTable binding="#{documentBean.dataTable}" value="#{documentBean.docList}" var="document" border="1" >
<h:column>
<h:selectBooleanCheckbox binding="#{documentBean.checkbox}"/>
</h:column>
<h:column>
<h:outputText value="#{document.nom}"/>
</h:column>
<h:column>
<h:outputText value="#{document.supp}"/>
</h:column>
</h:dataTable>
<br/>
<h:commandButton value="Supprimer" action="#{document.removeSelection}"/>
<h:commandButton value="Ajouter" action="#{document.ajouter}"/>
</h:form>
</f:view> |
extrait du face-config
Code:
1 2 3 4 5 6 7
| <managed-bean>
<managed-bean-name>documentBean</managed-bean-name>
<managed-bean-class>
com.jsf.bean.document.DocumentBean
</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean> |
extrait du managedBean
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| public DocumentBean()
{
listDocument();
}
/**
* Action removeSelection
*
* @return
*/
public String removeSelection()
{
int size = this.dataTable.getRowCount();
List selected = new ArrayList();
for (int i = 0; i < size; i++)
{
this.dataTable.setRowIndex(i);
if (this.checkbox.isSelected())
{
selected.add(this.docList.get(i));
log.trace("Suppression de l'entree" + ((Listator) docList.get(i)).getId());
}
}
return null;
}
public void nextPage()
{
firstResult=+maxResult;
listDocument();
}
public void prevPage()
{
firstResult=-maxResult;
listDocument();
}
/**
* Action Ajout d'un document
*
* @return
*/
public String ajouter()
{
log.trace("Ajout");
return "ajout";
} |
[/code]