I am trying to put a commandLink in a column of a datatable, however clicking the link, the method is not called in backbean, screen refresh and nothing happens.
I know that there are several topic on the internet about my problem. I already tried all the solutions and donk worked. I've tried changing the scope of the bean, tried to switch to h:commandLink I cleaned my html and removed the template and nothing resolved. what am I doing wrong? follow my code:
i am use glasshfish 3 and primeface 3.5
xhtml:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<h:head></h:head>
<h:body>
<h:form id="formTournament">
<p:messages id="messages" />
<p:dataTable id="tableTournaments"
value="#{tournamentBean.lazyModel}" var="tournament">
<p:column>
<p:commandLink id="signupt" action="#{tournamentBean.signUpTournament}"
update=":formTournament">
<f:setPropertyActionListener value="#{tournament}"
target="#{tournamentBean.selectedTournament}" />
</p:commandLink>
</p:column>
</p:dataTable>
</h:form>
</h:body>
</html>
Bean
@ManagedBean
@ViewScoped
public class TournamentBean{
private Tournament selectedTournament;
public TournamentBean() {
this.selectedTournament = new Tournament();
}
public void signUpTournament() {
this.tournamentController.signUpTournament(this.selectedTournament);
}
//getters and setters
}
Thanks for help!
<div class="container">and<h:graphicImage>absolutely necessary in order to reproduce your problem? And thelazy="true"? Andpaginator="true"? Etc..etc.. Just remove every single tag/attribute/line which doesn't play any significant role in the problem. - BalusCSimpleAbstractBeanandTournamentBeanare missing. Can't you just merge them into one bean for SSCCE purposes? Also, a more technical description of "can not call the method" would be very helpful. Isn't the problem just thatselectedTournamentisnullat the moment action is invoked? The code posted so far namely suggests that, but you seem to imply that the method is never hit. - BalusC