Если вы используете f:selectItems
, используйте конструктор SelectItem
с аргументом disabled
.
public class Bean {
private List<SelectItem> selectItems;
public Bean() {
selectItems = new ArrayList<SelectItem>();
selectItems.add(new SelectItem(1, "Form 1", null, false));
selectItems.add(new SelectItem(2, "Form 2", null, false));
selectItems.add(new SelectItem(3, "Form 3", null, false));
selectItems.add(new SelectItem(4, "Form 4", null, true));
selectItems.add(new SelectItem(5, "Form 5", null, true));
}
// getter for selectItems field ...
}
Или, если вы используете f:selectItem
, используйте атрибут itemDisabled
.
<f:selectItem itemValue="1" itemLabel="Form 1" itemDisabled="false" />
<f:selectItem itemValue="2" itemLabel="Form 2" itemDisabled="false" />
<f:selectItem itemValue="3" itemLabel="Form 3" itemDisabled="false" />
<f:selectItem itemValue="4" itemLabel="Form 4" itemDisabled="true" />
<f:selectItem itemValue="5" itemLabel="Form 5" itemDisabled="true" />