wood burning stoves 2.0*
The moose likes JSF and the fly likes problem in setting action to UICommand - HtmlCommandLink Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "problem in setting action to UICommand - HtmlCommandLink" Watch "problem in setting action to UICommand - HtmlCommandLink" New topic
Author

problem in setting action to UICommand - HtmlCommandLink

Pushpalatha Gowdra
Greenhorn

Joined: Jan 25, 2008
Posts: 18
Hi,

I am trying to add a command link to a dynamic dataTable. to achieve this I have written the code as below:

Application application = context.getApplication();
UICommand out = (UICommand) application.createComponent("javax.faces.HtmlCommandLink");

UIOutput output = new UIOutput();
ValueBinding vb = context.getApplication().createValueBinding("#{user." + cols[i] + "}");
output.setValueBinding("value", vb);

out.getChildren().add(output);

MethodBinding mb = application.createMethodBinding("#{navigate.updateUser}", new Class[0]);
out.setAction(mb);

out.setImmediate(true);

col.getChildren().add(out);

Here user & navigate are backing beans.

The table is rendered and the column with command link shows the link, but on click of that link the same page is getting reloaded instead of calling the action set for the command link.

Some one please help me and let me know what's wrong in the above code. Is there any other way to achieve the above requirement.

Thanks in advance.

Regards,
Pushpa
 
Consider Paul's rocket mass heater.
 
subject: problem in setting action to UICommand - HtmlCommandLink