Reputation: 259
I have a <h:commandButton>
<f:metadata>
<f:viewParam name="uri" value="#{pesquisaBean.selectedUri}" />
<f:event listener="#{pesquisaBean.searchElement()}" type="preRenderView"></f:event>
</f:metadata>
<h:head>
<title>Detalhes do Documento</title>
</h:head>
<h:body>
<br />
Detalhes do Documento
<br />
<br />
<rich:dataTable value="#{pesquisaBean.documentDetailsByTitle}" var="result">
<c:forEach items="#{pesquisaBean.variableNamesDetails}" var="vname">
<rich:column>
<f:facet name="header">#{vname}</f:facet>
#{result[vname]}
</rich:column>
</c:forEach>
</rich:dataTable>
<br />
<h:commandButton value="Excluir" action="#{pesquisaBean.delete()}" />
<br />
<br />
and this action method
public void delete() {
System.out.println("Hello");
this.removeDocument(databaseModel, this.selectedDocument);
System.out.println("");
System.out.println("After deleting!!!!!!!!!!!!");
StmtIterator result = databaseModel.listStatements();
while( result.hasNext() ) {
Statement stmt = result.next();
System.out.println(stmt);
}
However, the command button doesn't call the action method.
I'm trying to print Hello
in the first line of the method, but it isn't printed.
How is this caused and how can I solve it?
Upvotes: 1
Views: 6333
Reputation: 21961
I guess, you didn't enclose <h:commandButton/>
with <h:form/>
. Try to call like:
<h:form>
<h:commandButton value="Excluir" action="#{pesquisaBean.delete()}" />
</h:form>
Whenever, you will working with JSF, always open development environment by writing following context-param
in web.xml
.
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
It will show warning, what is missing in xhtml.
Upvotes: 13