UIColumn columnComponent = new UIColumn();
HtmlOutputText headerComponent = new HtmlOutputText();
headerComponent.setValue("MAJ");
columnComponent.setHeader(headerComponent);
HtmlCommandLink htmlCommandLink=(HtmlCommandLink)app.createComponent (HtmlCommandLink.COMPONENT_TYPE);
htmlCommandLink.setValue("Update");
Class[] argTypes = {ActionEvent.class };
MethodBinding vb=FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{renderer.update}", argTypes);
htmlCommandLink.setActionListener(vb);
MethodBinding mb = app.createMethodBinding("#{renderer.updateLine}",null);
htmlCommandLink.setAction(mb);
columnComponent.getChildren().add(htmlCommandLink);
childrenList.add(columnComponent);
HtmlOutputText headerComponent = new HtmlOutputText();
headerComponent.setValue("MAJ");
columnComponent.setHeader(headerComponent);
HtmlCommandLink htmlCommandLink=(HtmlCommandLink)app.createComponent (HtmlCommandLink.COMPONENT_TYPE);
htmlCommandLink.setValue("Update");
Class[] argTypes = {ActionEvent.class };
MethodBinding vb=FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{renderer.update}", argTypes);
htmlCommandLink.setActionListener(vb);
MethodBinding mb = app.createMethodBinding("#{renderer.updateLine}",null);
htmlCommandLink.setAction(mb);
columnComponent.getChildren().add(htmlCommandLink);
childrenList.add(columnComponent);
本文介绍了一个使用JavaServer Faces (JSF)创建可更新UI组件的例子。通过实例代码展示了如何设置UIColumn组件,并为其添加一个HtmlCommandLink作为更新触发器。具体包括设置组件属性、绑定方法、以及将组件添加到子组件列表中。
177

被折叠的 条评论
为什么被折叠?



