开发者

can i make my dropdown box defaulted to empty and if i click on dropdown it should the values

开发者 https://www.devze.com 2022-12-09 19:37 出处:网络
hi my dropdown has some 3 values 1)Apple 2)mango 3)grape 开发者_Go百科when my page loads my dropdown is defaulted to Apple(first value)

hi my dropdown has some 3 values

1)Apple 2)mango 3)grape

开发者_Go百科when my page loads my dropdown is defaulted to Apple(first value)

how can i make dropdown defaulted to empty and when i clicked on dropdown it should show the values

in java jsf (i am getting dropdown values as List)


I would just add an empty option, and validate as needs be.


I generally add an empty field with a null ID and a value that says something like "Select Fruit". I believe you can have both selectItem and selectItems. So something like this should work inside your JSF selectOneMenu component:

<f:selectItem itemValue="" itemLabel="Select Fruit" />
<f:selectItems value="#{fruitList}" /> 
0

精彩评论

暂无评论...
验证码 换一张
取 消