RichFaces rich:collapsibleSubTable不通过ajax加载结果

时间:2013-03-25 11:29:00

标签: jsf jsf-2 richfaces

我试图通过一个paramatized ajax方法调用填充一个rich:collapsalbeSubTable。

目的是显示客户列表,当选择客户时,必须进行ajax调用以加载合同列表以填充子表。

<rich:dataTable value="#{searchController.results}" var="customer">

    <rich:column colspan="2">
        <rich:collapsibleSubTableToggler for="contractSubTable" />
        <h:outputText value="#{customer.name}" />
    </rich:column>

    <rich:collapsibleSubTable
        value="#{searchController.getFirstTenContracts(customer.partnerId)}"
        var="contract" id="contractSubTable" expanded="false"
        expandMode="ajax">

        <rich:column>
            <h:outputText value="#{contract.contractId}" />
        </rich:column>
        <rich:column>
            <h:outputText value="#{contract.contractDesc}" />
        </rich:column>

    </rich:collapsibleSubTable>

</rich:dataTable>

然而,这导致以下例外:

javax.servlet.ServletException: javax.el.ELResolver.invoke(Ljavax/el/ELContext;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:221)
    de.hglv.ebusiness.core.presentation.listener.DisableUrlSessionFilter.doFilter(DisableUrlSessionFilter.java:79)



root cause 

java.lang.NoSuchMethodError: javax.el.ELResolver.invoke(Ljavax/el/ELContext;Ljava/lang/Object;Ljava/lang/Object;[Ljava/lang/Class;[Ljava/lang/Object;)Ljava/lang/Object;
    com.sun.el.parser.AstValue.getValue(AstValue.java:111)
    com.sun.el.parser.AstValue.getValue(AstValue.java:163)
    com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:219)
    org.apache.myfaces.view.facelets.el.ContextAwareTagValueExpression.getValue(ContextAwareTagValueExpression.java:94)
    javax.faces.component._DeltaStateHelper.eval(_DeltaStateHelper.java:246)
    org.richfaces.component.UISequence.getValue(UISequence.java:175)
    org.richfaces.component.UISequence.createExtendedDataModel(UISequence.java:109)
    org.richfaces.component.UIDataTableBase.createExtendedDataModel(UIDataTableBase.java:231)
    org.richfaces.component.UIDataAdaptor.getExtendedDataModel(UIDataAdaptor.java:459)
    org.richfaces.component.UIDataAdaptor.getRowCount(UIDataAdaptor.java:506)
    org.richfaces.renderkit.AbstractTableRenderer.encodeTableRows(AbstractTableRenderer.java:131)
    org.richfaces.renderkit.AbstractTableRenderer.doEncodeChildren(AbstractTableRenderer.java:195)
    org.richfaces.renderkit.RendererBase.encodeChildren(RendererBase.java:157)
    javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:508)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:674)
    org.richfaces.renderkit.DataTableRenderer.encodeRow(DataTableRenderer.java:229)
    org.richfaces.renderkit.AbstractRowsRenderer.process(AbstractRowsRenderer.java:80)
    org.ajax4jsf.model.SequenceDataModel.walk(SequenceDataModel.java:65)
    org.richfaces.component.UIDataAdaptor.walk(UIDataAdaptor.java:796)
    org.richfaces.renderkit.AbstractRowsRenderer.encodeRows(AbstractRowsRenderer.java:90)
    org.richfaces.renderkit.AbstractRowsRenderer.processRows(AbstractRowsRenderer.java:103)
    org.richfaces.renderkit.AbstractTableRenderer.encodeTableRows(AbstractTableRenderer.java:141)
    org.richfaces.renderkit.AbstractTableRenderer.doEncodeChildren(AbstractTableRenderer.java:195)
    org.richfaces.renderkit.RendererBase.encodeChildren(RendererBase.java:157)
    javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:508)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:674)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:681)
    org.richfaces.renderkit.RendererBase.renderChildren(RendererBase.java:276)
    org.richfaces.renderkit.html.PanelRenderer.encodeEnd(PanelRenderer.java:181)
    javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:539)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:685)
    javax.faces.component.UIComponent.encodeAll(UIComponent.java:681)
    org.apache.myfaces.view.facelets.FaceletViewDeclarationLanguage.renderView(FaceletViewDeclarationLanguage.java:1695)
    org.apache.myfaces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:281)
    javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59)
    org.apache.myfaces.tomahawk.application.ResourceViewHandlerWrapper.renderView(ResourceViewHandlerWrapper.java:93)
    javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:59)
    org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:90)
    org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:239)
    javax.faces.webapp.FacesServlet.service(FacesServlet.java:191)
    de.hglv.ebusiness.core.presentation.listener.DisableUrlSessionFilter.doFilter(DisableUrlSessionFilter.java:79)

)
    de.hglv.ebusiness.core.presentation.listener.DisableUrlSessionFilter.doFilter(DisableUrlSessionFilter.java:79)

Controller方法的签名是:

public List<Contract> getFirstTenContracts(Object partnerId)

如果我的做法有问题,有人可以帮我解决这个问题,或指出我正确的方向。

1 个答案:

答案 0 :(得分:1)

java.lang.NoSuchMethodError解决了问题:

你的方法签名有一个Object类型的参数,你传递的是我认为是int的东西。即使在普通的旧java中,这也会导致编译失败。

只需更改方法签名即可。