seinecle
seinecle

Reputation: 10768

how to add an "update" attribute to a commandButton created dynamically

I try to create a <h:commandButton> dynamically, from a bean. It must look like:

<h:commandButton actionListener="#{bean.okUpdate("1234")}" title="ok" value="ok" id="ok_1234" update:"otherComponent"/>

So far, the code in the bean to create this button:

    HtmlCommandButton okUpdate = new HtmlCommandButton();
    okUpdate.setLabel("ok");
    okUpdate.setValue("ok");
    okUpdate.setId("okUpdate_" + uuid);
    okUpdate.setActionExpression(createMethodExpression(String.format("#{bean.okUpdate('" + uuid + "')}", "ok"), null, String.class));

-> which code should I add so that the commandButton includes update:"otherComponent" as well?

Upvotes: 0

Views: 177

Answers (1)

Makky
Makky

Reputation: 17463

Use Primefaces CommandButton class Reference here

org.primefaces.component.CommandButton. 

It has an "update" value expression.

Upvotes: 1

Related Questions