Hi guys..how do i create a commandlink at runtime? i tried doing this:
FacesContext facesContext = FacesContext.getCurrentInstance();
Application application = facesContext.getApplication();
//UICommand output = (UICommand) application.createComponent("javax.faces.HtmlCommandLink");
UIOutput output = (UIOutput) application.createComponent("javax.faces.HtmlOutputLabel");
output.getAttributes().put("value","TEST DYNAMIC");
output.getAttributes().put("actionListener","#{PersonBean2.saveRecord}");
output.getAttributes().put("action","Ethan");
component.getChildren().add(output);
But it only works for outputLabels..i get a type mismatch error when i use it for commandLinks
Please help!
FacesContext facesContext = FacesContext.getCurrentInstance();
Application application = facesContext.getApplication();
//UICommand output = (UICommand) application.createComponent("javax.faces.HtmlCommandLink");
UIOutput output = (UIOutput) application.createComponent("javax.faces.HtmlOutputLabel");
output.getAttributes().put("value","TEST DYNAMIC");
output.getAttributes().put("actionListener","#{PersonBean2.saveRecord}");
output.getAttributes().put("action","Ethan");
component.getChildren().add(output);
But it only works for outputLabels..i get a type mismatch error when i use it for commandLinks
Please help!