webtier@glassfish.java.net

Re: Programmatic CommandButton+action method

From: <webtier_at_javadesktop.org>
Date: Tue, 07 Jul 2009 08:14:03 PDT

Not sure what that Utils.createMethodExpression(...) method does, but the following works for me.

[code]
FacesContext context = FacesContext.getCurrentInstance();
Application app = context.getApplication();
ExpressionFactory f = app.getExpressionFactory();
MethodExpression expr = f.createMethodExpression(context.getELContext(),
"#{beszTervEdit.doAction}", String.class, new Class<?>[]{});
[/code]

Did you remember to put the button inside a HtmlForm element?

[code]
UIComponent form = FacesContext.getCurrentInstance().getViewRoot().findComponent("form")
form.getChildren().add(appendCategoryButton);
[/code]

(I'm running against the latest nightly build)

/j
[Message sent by forum member 'janderssn' (janderssn)]

http://forums.java.net/jive/thread.jspa?messageID=354360