Hi,
I 've 2 buttons (a4j:commandbutton) and i use the same EL for execute attribute, with actionlistener to update the property (the same property used for EL).
This is the code xhtml :
<a4j:commandButton id="ajouter" value="Ajouter" actionListener="#{administrationController.executeListener}" action="#{administrationController.ajouter}" execute="#{administrationController.titres}" /> <a4j:commandButton id="supprimer" value="Supprimer" actionListener="#{administrationController.executeListener}" action="#{administrationController.supprimer}" execute="#{administrationController.titres}" />
It's ok when i only click on one button ("supprimer" or "ajouter"), but when i change ("ajouter" and after "supprimer" or "supprimer" and after "ajouter") i 've got an error on the first click because execute attribut has datas from the first button clicked. And after the pb when i click again it's ok because i 've the good execute attribut.
My listener :
... public void executeListener(ActionEvent event){ String component = event.getComponent().getId(); String attribut = (String) event.getComponent().getAttributes().get("execute"); System.out.println("======"); System.out.println("LISTENER EXECUTE=> "+component); System.out.println("======="); System.out.println("attribut : "+attribut); if (component.equals("ajouter")) setTitres("inputAbrege inputTitre"); else if (component.equals("supprimer")) setTitres("selectTitre"); else System.out.println("pas dans le if"); attribut = (String) event.getComponent().getAttributes().get("execute"); System.out.println("attribut2 : "+attribut+" et titre : "+getTitre()); } ...
I don't know how to update the component a4j:button correctly. In others words how to update EL with the good IDS?
I use JSF2 and RF4
Thanks.
Kind regards
Couse1