使用Set <requestvo> </requestvo>填充数据表

时间:2012-05-10 12:44:32

标签: java hibernate jsf

我打电话给这个方法:

public Set<RequestVO> getRequestBySupplier(SupplierVO objectVO)

我有OrderController这个属性和方法,只需点击一下按钮就可以调用:

public Set<RequestVO> requestList

public void listOrders()
{
     requestList = requestBO.getRequestBySupplier(supplierVO);
}

调试我可以看到requestList已填充了正确的信息。 在我的orderSearch.html我有这个数据表:

<ui:fragment rendered="#{not empty orderController.requestList}">
     <h:dataTable value="#{orderController.requestList}" var="order">
          <h:column>
               <f:facet name="header">#</f:facet>
               <h:outputText value="#{order.id}" escape="false" />
          </h:column>
     </h:dataTable>
</ui:fragment>

我有orderController requestList获取和设置方法。

当我运行代码时,我收到此错误:

  

/views/fornecedor/orderSearch.xhtml @ 34,84 value =&#34;#{order.id}&#34;:The   class&#39; java.util.HashSet&#39;没有属性&#39; id&#39;。

Stack Trace

  

javax.el.PropertyNotFoundException:   /views/fornecedor/orderSearch.xhtml @ 34,84 value =&#34;#{order.id}&#34;:The   class&#39; java.util.HashSet&#39;没有财产&#39; id&#39;。在   com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:111)     在   javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194)     在   javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182)     在javax.faces.component.UIOutput.getValue(UIOutput.java:169)at   com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:205)     在   com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:355)     在   com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:164)     在   javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)     在   com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)     在   com.sun.faces.renderkit.html_basic.TableRenderer.renderRow(TableRenderer.java:384)     在   com.sun.faces.renderkit.html_basic.TableRenderer.encodeChildren(TableRenderer.java:161)     在   javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)     在javax.faces.component.UIComponent.encodeAll(UIComponent.java:1757)     在javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)     在javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)     在javax.faces.component.UIComponent.encodeAll(UIComponent.java:1760)     在   com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402)     在   com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)     在   com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)     在com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)at   com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)     在javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)at   org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)     在com.erp3.gui.filters.SessionFilter.doFilter(SessionFilter.java:31)     在   org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256)     在   org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217)     在   org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279)     在   org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)     在   org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)     在   org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)     在   org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)     在   org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)     在   org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)     在   com.sun.enterprise.v3.services.impl.ContainerMapper $ AdapterCallable.call(ContainerMapper.java:317)     在   com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)     在   com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849)     在   com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746)     在   com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045)     在   com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228)     在   com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)     在   com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)     在   com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)     在   com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)     在   com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)     在   com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)     在com.sun.grizzly.ContextTask.run(ContextTask.java:71)at   com.sun.grizzly.util.AbstractThreadPool $ Worker.doWork(AbstractThreadPool.java:532)     在   com.sun.grizzly.util.AbstractThreadPool $ Worker.run(AbstractThreadPool.java:513)     在java.lang.Thread.run(Thread.java:722)

1 个答案:

答案 0 :(得分:2)

h:datatable不支持Set,您可以将其转换为List

例如

public List <RequestVO> getListAsSet(Set<RequestVO> set) {
  return new ArrayList<RequestVO>(set);
}

b.t.w ui:repeat也不支持Set