Je crée un custom component qui doit gérer des commandlink.
Je n'arrive pas à faire executer l'action du commandlink générer dans mon encodeBegin de l'implémentation UIComponentBase.
Le lien est bien affiché dans la page, mais le lien ne déclenche pas l'action
J'ai testé l'action via un appel direct dans la page jsp et cela fonctionne -->
(
<h:commandLink id="testAction"
actionListener="#{testAction.doTestAction}"
styleClass="image">
<h:outputText value="clickaction" />
</h:commandLink>
)
voila le code qui me pose pb:
public void encodeBegin(FacesContext context) throws IOException {
MethodBinding binding = context.getCurrentInstance()
.getApplication().createMethodBinding(
"#{testAction.doTestAction}", null);
HtmlCommandLink link = createLink(context);
HtmlOutputText uiText = createOutputText(context);
HtmlForm form = new HtmlForm();
uiText.setTransient(true);
uiText.setValue("Mon lien");
link.setTransient(true);
link.getChildren().add(uiText);
link.setActionListener(binding);
form.getChildren().add(link);
form.encodeBegin(context);
link.encodeBegin(context);
uiText.encodeBegin(context);
uiText.encodeEnd(context);
link.encodeEnd(context);
form.encodeEnd(context);
}
Merci
Partager