迭代具有值包含 List ,包含另一个列表不起作用?
我正在使用 richFaces 3.3 和 JSF 1.2。
在我的示例应用程序中,我需要显示其中的项目列表,并且还包含 即( 2 列有,第三列是)
如果我尝试在另一个列表中给出 List 作为 rich:columns 的值,则意味着它不起作用,但直接 bean 值正在起作用???
mainClass
具有 String item1 、 String item2 的 getter 、 setter ,
mainList
contains item 1
item 2
List<price> priceList like that...
so in <rich:dataTable> if i try to give value like
<rich:dataTable id="positions" value="#{bean.mainList}" var="var">
<rich:column>
<f:facet name="header">
<h:outputText value="item1"/>
</f:facet>
<h:outputText id="contname" value="#{var.item1}">
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="item2"/>
</f:facet>
<h:outputText id="contname" value="#{var.item2}">
</rich:column>
<rich:columns value="#{var.priceList}" var="partnerPriceItem" columns="2" index="ind">
<f:facet name="header">
<h:outputText id="output#{ind}" value="#{partnerPriceItem.id}" />
</f:facet>
<h:outputText id="price#{ind}" value="#{partnerPriceItem.price}" />
</rich:columns>
</rich:dataTable>
前 2 列在这里列出 PriceList 工作正常。但是当我尝试从另一个列表提供引用时意味着不起作用?
输出类似
物品 1 物品 2 价格1 价格2 价格3
1 2 100 200 300
2 2 50 100 75
I'm using richFaces 3.3 and JSF 1.2.
In my sample application I need to display List of items in and contains also
i.e( 2 columns having and third one is )
If I try to give List with in another List as value for rich:columns means its not working but direct bean value is working ???
mainClass
having getter , setter of String item1 , String item2, List priceList
mainList
contains item 1
item 2
List<price> priceList like that...
so in <rich:dataTable> if i try to give value like
<rich:dataTable id="positions" value="#{bean.mainList}" var="var">
<rich:column>
<f:facet name="header">
<h:outputText value="item1"/>
</f:facet>
<h:outputText id="contname" value="#{var.item1}">
</rich:column>
<rich:column>
<f:facet name="header">
<h:outputText value="item2"/>
</f:facet>
<h:outputText id="contname" value="#{var.item2}">
</rich:column>
<rich:columns value="#{var.priceList}" var="partnerPriceItem" columns="2" index="ind">
<f:facet name="header">
<h:outputText id="output#{ind}" value="#{partnerPriceItem.id}" />
</f:facet>
<h:outputText id="price#{ind}" value="#{partnerPriceItem.price}" />
</rich:columns>
</rich:dataTable>
here for first 2 columns working fine. but when I try to give referencing from another List means not working ??
output like
item 1 item 2 price1 price2 price3
1 2 100 200 300
2 2 50 100 75
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要解决您的问题,您需要使用
rich:dataTable
和rich:subTable
。 exadel 现场演示 站点。让我们看一下代码(这不是站点的真实代码,它只是一个了解想法的示例):
Java 类
我们有包含 ExpReport 实例的托管 bean Report。在 ExpReport 中,我们有一个记录列表(我们要在表中显示的列表),但每个记录都有自己的内部费用列表(我们要与记录一起显示的列表)。现在,我们只需要在其中设置 rich:dataTable 和 rich:subTable 即可在我们的 jsp 中获得神奇的效果。
注意:您可以在 rich:column< 的文档中获取更多信息/a>.
抱歉我的英语不好,希望这对您的申请有所帮助。
To resolve your problem, you need to use the
rich:dataTable
andrich:subTable
. There is an example in the exadel live demo site.Let's have a look in the code (this is not the real code of the site, it's just an example to get the idea):
Java Classes
We have the managed bean Report that contains an instance of ExpReport. Inside ExpReport we have a List of Records (the list we want to display in the table), but each record has its own inner List of Expenses (the list we want to display along with the records). Now, we just need to set up our rich:dataTable and the rich:subTable in it to get the magic flowing in our jsp.
Note: You can get more info on the documentation of rich:column.
Sorry for my bad english, I hope this can be helpful in your application.