0 Replies Latest reply on Nov 23, 2009 3:58 AM by jsfgeeks

    Problem in actionevent of dynamically created link/button

    jsfgeeks

      Hi all,

      I have problem with the action event of dynamically created link. I have to create ajaxCommandLink dynamically. I can do that easily. But I am not able to provide action event OR action listener to that link.

      I have tried the following, but didn't get success in that,

      while(rs.next())
      {
      HtmlAjaxCommandLink car_name = new HtmlAjaxCommandLink();
       car_name.setValue(rs.getString("car_name"));
      
      Class[] params = {};
      MethodExpression actionExpression = FacesContext.getCurrentInstance().getApplication().getExpressionFactory().createMethodExpression(FacesContext.getCurrentInstance().getELContext(), "#{car_details.action_car_details}", String.class, params);
      car_name.setActionExpression(actionExpression);
       int car_id = rs.getInt("car_id");
       String onClick = "action_car_details(car_id)";
       car_name.setOnclick(onClick);
       pnlgrp_car_assigned_detail.getChildren().add(car_name);
      }
      


      And my action event is like;

      public String action_car_details(int cid)
       {
       System.out.println("\n\t Selected car id : "+cid);
       .
       .
       .
       return null;
       }
      


      Any help will be appreciated.

      Thanks in advance,
      JSF GEEKS