commandlink action doesn't fire inside p:accordion

861 Views Asked by At

I have command link inside an accordion inside of primefaces wizard and they're all in the same form - I don't have nested forms and yet the action of the command link is not fired. Here's my page:

    <ui:define name="content">
       <h:form id="createSubject"> 
        <p:wizard flowListener="#{createWizard.flowListener}" widgetVar="wiz" showNavBar="false">  
        <p:tab id="personal" title="#{createWizard.tab1Title}">  
          ....
        </p:tab>
        <p:tab id="conclusion" title="#{createWizard.tab2Title}">  
          <p:panel header="#{createWizard.panel2Title}">  
            <p:accordionPanel value="#{createWizard.similarSubjects}" var="subject">  
                <p:tab title="#{subject.VPrenom} #{subject.VNom}"> 
                   <h:panelGrid columns="2" cellpadding="5">  
                     <h:outputText value="#{createWizard.firstName}: " />  
                     <h:outputText value="#{subject.VPrenom}" />  
                     <h:commandLink  value="#{createWizard.completeSheet}" actionListener="#{createWizard.completeSubjectSheet(subject.VIdPool)}"/>
                    </h:panelGrid>  
                 </p:tab>  
            </p:accordionPanel>  
         </p:panel>  
         </p:tab> 
         </p:wizard>
         <p:commandButton value="#{createWizard.nextButtonTitle}" onclick="wiz.next()" style="float:right;"/>
         </h:form>
        </ui:define>

and my backing bean method:

    public void completeSubjectSheet(String subId){
    mk.sdc.helpers.Link link = mk.sdc.helpers.Link.getLink();
    try {
      FacesContext.getCurrentInstance().getExternalContext().redirect(link.mkLink("/POOL/view.jsp?V_ID_POOL="+subId));
    } catch (IOException ex) {
        Logger.getLogger(CreateWizard.class.getName()).log(Level.SEVERE, null, ex);
    }
}

Any ideas? Thanks.

1

There are 1 best solutions below

4
On

Because actionListener can't take any arguments, you have to use action attribute for commandLink.

EDIT

Can you use h:link or h:outputLink for that?Like

<h:link outcome="/POOL/view.jsp?V_ID_POOL=#{subject.id}" />