Création dynamique d'un HtmlAjaxCommandLink -> impossible de faire fonctionner un reRender
Bonjour,
Je suis un peu paumé sur ce probléme.
Voici le bout de code que j'ai dans une JSP
Code:
1 2 3 4 5
|
<a4j:commandLink ajaxSingle="true" id="editlink" action="#{offBean.doEdit}" reRender="offerOptionForm">
<h:graphicImage value="/images/icons/edit.jpg" style="border:0" />
<f:setPropertyActionListener value="#{off}" target="#{offBean.offer}" />
</a4j:commandLink> |
J'essaie de faire la même opération mais dynamiquement, j'arrive à tous faire sauf l'action reRender.
Voici le code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
//Création de l'objet parent "HtmlAjaxCommandLink"
HtmlAjaxCommandLink actionCommandLink = new HtmlAjaxCommandLink();
actionCommandLink.setId("updatelink");
actionCommandLink.setReRender("offerOptionForm");
//Création d'un objet fils "HtmlGraphicImage"
HtmlGraphicImage actionGraphicImage = new HtmlGraphicImage();
actionGraphicImage.setId("updatelinkImage");
actionGraphicImage.setValue("/images/icons/update.jpg");
actionGraphicImage.setStyle("border:0");
actionCommandLink.getChildren().add(actionGraphicImage);
//Création d'actionListener
FacesContext facesContext = FacesContext.getCurrentInstance();
MethodExpression nextActionListener = facesContext.getApplication().getExpressionFactory().createMethodExpression(facesContext.getELContext(), "#{offBean.doUpdate}", null, new Class[] {ActionEvent.class});
actionCommandLink.addActionListener(new MethodExpressionActionListener(nextActionListener));
... |
Merci pour ceux qui prendront la peine de trouver une solution a mon probléme ;-)