3 Replies Latest reply on Apr 9, 2011 1:34 AM by Saurabh Tyagi

    How do i setPropertyActionListener while creating a link dynamically ?

    Saurabh Tyagi Newbie

      Hello All

       

      How do i set PropertyActionListener while creating a link dynamically ?

       

      i am using

      <a4j:commandLink style="color:darkred; font-size:1.000em;"  id="download" value="Download" action="#{agentRecording.downLoadFile}">

                 <f:setPropertyActionListener target="#{agentRecording.selectedFile}" value="#{recording}" /> 

      </a4j:commandLink>  

       

      it is working fine

       

      but while i create a link dynamically than i am not able to understand that how do i set this PropertyActionListener at backend been

       

      i an trying ....

       

      private HtmlPanelGrid downloadPanalGrid; // and its getter setter

      public String addDownLoadLink()

                {

                          String result="success";

       

        HtmlCommandLink dLink = new HtmlCommandLink();

        dLink.setValue("Download");

                          String action = "#{agentRecording.downLoadFile}";

                          MethodExpression methodExpression = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().    createMethodExpression(FacesContext.getCurrentInstance().getELContext(), action, null, new Class<?>[0]);

                          dLink.setActionExpression(methodExpression);

                          getDownloadPanalGrid().getChildren().add(dLink);

                          return result;

                }

       

       

      please help..