Monday, October 8, 2012

Send Parameters to ActionListener and read it programmatically



You can send parameters when invoking ActionListener behavior by adding the f:attribute tag to Action issuer as explained below on commandButton component:



<af:commandButton text="send attribute" id="cb1"    actionListener="#{bean.method1}">    <f:attribute name="param" value="value"/></af:commandButton>




Then you can read  the attribute programmatically inside the method:

 public void method1(ActionEvent actionEvent) {
    String param = (String)actionEvent.getComponent().getAttributes().get("param");
    System.out.println(param);
    }

3 comments:

  1. The programming will be difficult without knowing the actual subject. These can be overcome by studying the subject. Once the person knows about the subject he will be well worsed in giving seminar or writing the program, The mentioned functionality is available in all the subjects like it starts from c THE BASIC LANGUAGE.

    ReplyDelete
  2. time is crucial my friend, internet, books, and blogs should make every thing easier.

    ReplyDelete
  3. This is very impressive post with every minute details mentioned and clearly expressed, great job.
    Web Designing Company in Chandigarh

    ReplyDelete