我在支持bean中创建模型。
我的java代码行是这样的
UIColumn column = new HtmlColumn();
dynamicDataTable.getChildren().add(column);
UIAjaxCommandLink editLink = new HtmlAjaxCommandLink();
editLink.setId("edit");
HtmlGraphicImage img = new HtmlGraphicImage();
img.setUrl("../images/edit.gif");
editLink.getChildren().add(img);
editLink.setActionExpression(createActionExpression("#{myBean.editRow}", String.class));
editLink.setAjaxSingle(true);
editLink.setValueExpression("onComplete", createValueExpression("#{rich:component('editPanel')}.show()", RichFunction.class));
editLink.setValueExpression("reRender", createValueExpression("editPanel", String.class));
column.getChildren().add(editLink);
我收到错误。同样适用于xhtml页面。
<a4j:commandButton value="Edit" ajaxSingle="true"
oncomplete="#{rich:component('editPanel')}.show()"
actionListener="#{myBean.addActionListener}" reRender="editPanel"/>
如何解决上述错误。
答案 0 :(得分:0)
我得到了解决方案,我把以下代码
editLink.setOncomplete("Richfaces.showModalPanel('editPanel');");
而不是
editLink.setValueExpression("onComplete", createValueExpression("#{rich:component('editPanel')}.show()", RichFunction.class))
McDowell :现在进入createValueExpression:
private ValueExpression createValueExpression(String valueExpression, Class<?> valueType) {
FacesContext facesContext = FacesContext.getCurrentInstance();
return facesContext.getApplication().getExpressionFactory().createValueExpression(
facesContext.getELContext(), valueExpression, valueType);
}
private MethodExpression createActionExpression(String actionExpression, Class<?> returnType) {
FacesContext facesContext = FacesContext.getCurrentInstance();
return facesContext.getApplication().getExpressionFactory().createMethodExpression(
facesContext.getELContext(), actionExpression, returnType, new Class[0]);
}
我使用此示例创建了包含动态列的表。
http://balusc.blogspot.com/2006/06/using-datatables.html#PopulateDynamicDatatable
感谢Bauke Luitsen Scholtz(BalusC)