我试图通过一个参数化的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方法的Signature是:
public List<Contract> getFirstTenContracts(Object partnerId)
如果我的方法有问题,请有人帮助我解决这个问题或指出我在正确的方向。
java.lang.NoSuchMethodError
给出了问题:
你的方法签名有一个类型为Object
的参数,你正在传递我认为是int
的参数。即使在普通的旧java中,这也会导致编译失败。
只要改变方法签名就可以了