javax.el.E​​LException:函数“丰富:组件”未找到

发布于 2024-11-30 15:11:40 字数 1029 浏览 0 评论 0原文

我正在支持 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"/>

我该如何解决上述错误。

I am creating the model in backing bean.

My java lines of code are like this

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);

I get an error. The same works for in the xhtml page.

<a4j:commandButton value="Edit" ajaxSingle="true" 
    oncomplete="#{rich:component('editPanel')}.show()" 
    actionListener="#{myBean.addActionListener}" reRender="editPanel"/>

How can I resolve the above error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

与往事干杯 2024-12-07 15:11:40

我得到了解决方案,我放置了以下代码

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)

I got the solution, I put the following code

editLink.setOncomplete("Richfaces.showModalPanel('editPanel');");

instead of

editLink.setValueExpression("onComplete", createValueExpression("#{rich:component('editPanel')}.show()", RichFunction.class))

McDowell : Now coming to the 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]);
}

I used the example from this to create this table with dynamic columns.

http://balusc.blogspot.com/2006/06/using-datatables.html#PopulateDynamicDatatable

Thanks Bauke Luitsen Scholtz (BalusC)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文