JSF 2 multiple select dropdown box example
2015-08-28 07:24
489 查看
In JSF,
However, the use of
<h:selectManyMenu />tag is used to render a multiple select dropdown box – HTML select element with “
multiple” and “
size=1” attribute.
//JSF... <h:selectManyMenu value="#{user.favCoffee1}"> <f:selectItem itemValue="Cream Latte" itemLabel="Coffee3 - Cream Latte" /> <f:selectItem itemValue="Extreme Mocha" itemLabel="Coffee3 - Extreme Mocha" /> <f:selectItem itemValue="Buena Vista" itemLabel="Coffee3 - Buena Vista" /> </h:selectManyMenu>
//HTML output... <select name="j_idt6:j_idt8" multiple="multiple" size="1"> <option value="Cream Latte">Coffee3 - Cream Latte</option> <option value="Extreme Mocha">Coffee3 - Extreme Mocha</option> <option value="Buena Vista">Coffee3 - Buena Vista</option> </select>
However, the use of
h:selectManyMenutag is highly NOT recommended, because they do not display consistently in different internet browsers, see figures :
1. Internet Explorer 8
A tiny scroll bar to manipulate the dropdown box values.2. FireFox 3.6.10
No scroll bar, look like a normal “textbox”, but you can click on the “textbox” and “drag up or down” or “key up and down” to manipulate the value.3. Google Chrome 6.0.472.63
In Google Chrome, both<< select element with "multiple" and size="1" attribute - "h:selectManyMenu” tag >>and
<< select element with "multiple" and size="total of records" attribute - "h:selectManyListbox” tag >>are display the exact layout.
Conclusion
Just forget about “h:selectManyMenu” tag, there is really no reason to use it. The “
h:selectManyListbox” tag is a good alternative.
相关文章推荐
- JSF 2 dropdown box example
- JSF 2 multiple select listbox example
- JSF 2 listbox example
- JSF 2 radio buttons example
- javascript使用本地cookie
- [Javascript] Linting JavaScript with ESLint
- XML和JSON的对比
- javaScript的设计模式之单例模式
- [LeetCode][JavaScript]Single Number III
- js中(function(){…})()立即执行函数写法理解
- Jsp内置对象及EL表达式的使用
- 浅谈JavaScript中的string拥有方法的原因
- 谈谈JavaScript中function多重理解
- js实现横向伸展开的二级导航菜单代码
- javascript Array类型 方法大全
- JS实现仿苹果底部任务栏菜单效果代码
- js实现显示当前状态的导航效果代码
- js游戏人物上下左右跑步效果代码分享
- js实现类似菜单风格的TAB选项卡效果代码
- js实现超简单的展开、折叠目录代码