java - Access bean inside repeat in jsf -
this question has answer here:
i have userprofilebean can access outside of repeat when do
<ui:repeat id="reqlistid" var="reqlist" value="#{userprofilebean.friendrequestslist}"> jmeno: #{reqlist.jmeno} <br/> prijmeni: #{reqlist.prijmeni} <br/> id: #{reqlist.id} <br/> <p:commandbutton id="allowfriendbutton" action="#{userprofilebean.allowfriend()}" value="přidat" update="reqlistid"> </p:commandbutton>
then allowfriend method doesn't called , netbeans says unknown property. missing something?
edit: replies. still doesn't work. state this.
<h:form> <p:commandbutton id="allson" action="#{userprofilebean.testt()}" value="přidat" ajax="false"> </p:commandbutton> </h:form> <c:if test="#{principalbean.p.login == userprofilebean.name}"> Žádosti přidání přátel:<br/> <ui:repeat id="reqlistid" var="reqlist" value="#{userprofilebean.friendrequestslist}"> jmeno: #{reqlist.jmeno} <br/> prijmeni: #{reqlist.prijmeni} <br/> id: #{reqlist.id} <br/> <h:form> <p:commandbutton id="allowfriendbutton" action="#{userprofilebean.testt()}" value="přidat" ajax="false"> </p:commandbutton> </h:form> <br/> </ui:repeat> </c:if>
the first <p:commandbutton>
works , calls method (with page reload). second button reloads page not call method. problem seems accessing userprofilebean inside repeat. can't google out explanation.
i guess you're missing form element. try putting buttons in form like
<h:form> <ui:repeat id="reqlistid" var="reqlist" value="#{userprofilebean.friendrequestslist}"> jmeno: #{reqlist.jmeno} <br/> prijmeni: #{reqlist.prijmeni} <br/> id: #{reqlist.id} <br/> <p:commandbutton id="allowfriendbutton" action="#{userprofilebean.allowfriend()}" value="přidat" update="reqlistid"> </p:commandbutton> </ui:repeat> </h:form>
Comments
Post a Comment