Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JSF/JBoss Seam操作指南:拆分一个列表<;项目>;在多个列表框上(h:selectManyListbox)_Jsf_Seam_Richfaces_Facelets - Fatal编程技术网

JSF/JBoss Seam操作指南:拆分一个列表<;项目>;在多个列表框上(h:selectManyListbox)

JSF/JBoss Seam操作指南:拆分一个列表<;项目>;在多个列表框上(h:selectManyListbox),jsf,seam,richfaces,facelets,Jsf,Seam,Richfaces,Facelets,我正在使用这些类: ShoppingCart <-ManyToMany-> Item <-ManyToOne-> ItemCategory 项目: 问题是: 假设我有: 项目类别1中的项目1、项目2、项目3 项目类别2中的项目4、项目5、项目6 我正在尝试构建一个页面,您可以在其中选择shoppingcart。类似以下项目: ItemCategory1: +-----------+ | Item1 |

我正在使用这些类:

ShoppingCart   <-ManyToMany->   Item   <-ManyToOne->  ItemCategory
项目: 问题是: 假设我有:
项目类别1中的项目1、项目2、项目3
项目类别2中的项目4、项目5、项目6

我正在尝试构建一个页面,您可以在其中选择shoppingcart。类似以下项目:

ItemCategory1: +-----------+
               | Item1     |
               | Item2     |
               | Item3     |  (multi-select with Ctrl)
               +-----------+

ItemCategory2: +-----------+
               | Item4     |
               | Item5     |
               | Item6     |  (multi-select with Ctrl)
               +-----------+
如何使用JSF/Facelets/Seam实现这一点

你对UI有更好的建议吗?(我不希望它是基于树的或单个列表框)


谢谢。

在初始化对象的方法中(可能是
@PostConstruct
),拆分值。例如在

private Map<ItemCategory<Item>, List<Item>> itemsByCategory;
private-Map-itemsByCategory;
然后用

<ui:repeat value="#{bean.itemsByCategory.entries}" var="entry">
     // show inputs, using entry.key and entry.value
</ui:repeat>

//使用entry.key和entry.value显示输入

同样的东西以前不起作用,但现在起作用了!谢谢
ItemCategory1: +-----------+
               | Item1     |
               | Item2     |
               | Item3     |  (multi-select with Ctrl)
               +-----------+

ItemCategory2: +-----------+
               | Item4     |
               | Item5     |
               | Item6     |  (multi-select with Ctrl)
               +-----------+
private Map<ItemCategory<Item>, List<Item>> itemsByCategory;
<ui:repeat value="#{bean.itemsByCategory.entries}" var="entry">
     // show inputs, using entry.key and entry.value
</ui:repeat>