0

我正在尝试通过参数化的 ajax 方法调用填充rich:collapsalbeSubTable。

The aim is to display a list of customers, when a customer is selected an ajax call has to be made to load the contract list to fill the sub table.

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

控制器方法的签名是:

public List<Contract> getFirstTenContracts(Object partnerId)

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

4

1 回答 1

1

java.lang.NoSuchMethodError给出了问题:

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

只需更改方法签名即可

于 2013-03-26T11:13:23.427 回答