when using JSF, some scenarios are difficult to deal with.
e.g. 1. multi rows raido buttons in dataTable
2. multi columns radio buttons in dataTable
The radio buttons don't fall in the one radio group, so they don't behave as one radio group
Solution: create customize component
step1, inherit and implement component class
add one overrideName field, so we can override the radio names generated by radio button. In this way, multi-row or column radios are considered in one radio group
step2, inherit and implement render class
override Decode(apply request phase, retrive the value from request obj and apply to component)
override Encode(render response phase)
step3, customize tag lib
http://www.javaworld.com/javaworld/jw-02-2007/jw-02-jsf.html?page=2
e.g. 1. multi rows raido buttons in dataTable
2. multi columns radio buttons in dataTable
The radio buttons don't fall in the one radio group, so they don't behave as one radio group
Solution: create customize component
step1, inherit and implement component class
add one overrideName field, so we can override the radio names generated by radio button. In this way, multi-row or column radios are considered in one radio group
step2, inherit and implement render class
override Decode(apply request phase, retrive the value from request obj and apply to component)
override Encode(render response phase)
step3, customize tag lib
http://www.javaworld.com/javaworld/jw-02-2007/jw-02-jsf.html?page=2
本文介绍在使用JSF框架时遇到的复杂场景解决方案,特别是如何处理数据表中的多行或多列Radio按钮组,确保它们被视为同一组。通过继承和实现组件及渲染类,可以定制Radio按钮组件。
358

被折叠的 条评论
为什么被折叠?



