简体   繁体   English

JSF从数据库填充selectOneMenu并处理启用/禁用的内容

[英]JSF Populate selectOneMenu from database and handle the enabled/disabled also

Hi I am wondering the best way to implement this requirement. 嗨,我想知道实现此要求的最佳方法。 I have a database table with a varchar2 field to populate the selectOneMenu. 我有一个带有varchar2字段的数据库表,用于填充selectOneMenu。 On the same table is a column of type CHAR(1) having a 'Y' or 'N' value, and I want to use this to also disable/enable the field. 在同一张表上是具有“ Y”或“ N”值的CHAR(1)类型的列,我想用它来禁用/启用该字段。

I was going for something simple like the first option demo in BalusC answer here How to populate options of h:selectOneMenu from database? 我正在寻找一些简单的东西,例如BalusC中的第一个选项演示,请点击此处如何从数据库中填充h:selectOneMenu的选项? and Here was a post I looked at having to do with disabling items in selectOneMenu - <h:selectOneMenu> with temporary disabled SelectItems 这是我看过的与禁用selectOneMenu中的项目有关的帖子- <h:selectOneMenu>与临时禁用的SelectItems

But I do not quite know how can I combine the two things above here in an EASY way to manage both enable/disabled and populating the list? 但是我不太清楚如何以一种轻松的方式将以上两点结合起来以管理启用/禁用和填充列表?

I just figured out that the best way is to create a custom object to back the values here. 我刚刚发现,最好的方法是创建一个自定义对象以支持此处的值。 For example: http://arjan-tijms.omnifaces.org/2011/12/automatic-to-object-conversion-in-jsf.html 例如: http : //arjan-tijms.omnifaces.org/2011/12/automatic-to-object-conversion-in-jsf.html

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

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