简体   繁体   English

JSF selectOneMenu不是整个列表

[英]JSF selectOneMenu not whole List

Is it possible to choose only specific items from the list in selectOneMenu? 是否可以从selectOneMenu的列表中仅选择特定项目? For example. 例如。 I have List Products has many fields like name, id etc. One of it is category (1,2 or 3) I want to have only one category in the selectOneMenu without making new Lists and new classes. 我有List Products,其中有许多字段,如名称,id等。其中一个是类别(1、2或3),我希望在selectOneMenu中仅具有一个类别,而无需创建新的列表和新类。 Can you help me? 你能帮助我吗?

I think the easiest way is to set the value attribute of f:selectItems to a method which filters your original collection. 我认为最简单的方法是将f:selectItemsvalue属性设置为一种过滤原始集合的方法。

Otherwise you'd have to implement your own version of f:selectItems which allows filtering - as we once did in one of our projects. 否则,您将必须实现自己的f:selectItems版本,该版本可以进行过滤-正如我们曾经在一个项目中所做的那样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM