Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes JSF and the fly likes Chaging the layout (pageDirection/lineDirection) of the HtmlSelectOneRadio Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Chaging the layout (pageDirection/lineDirection) of the HtmlSelectOneRadio" Watch "Chaging the layout (pageDirection/lineDirection) of the HtmlSelectOneRadio" New topic

Chaging the layout (pageDirection/lineDirection) of the HtmlSelectOneRadio

Silvester Stalin Bruno

Joined: Aug 16, 2007
Posts: 3

I have a jsf page, where i include radio buttons as shown below to display US states

As the number of states is "50", i cannot use the layout pageDirection/lineDirection. In either case, the page becomes extended.

Instead, i want to create a custom radion button component, in which i get the user input to show the buttons as a matrix (a x b), where a is number of rows
and b is numer of columns. So, i can display the US states as a 5 x 10 matrix. Here, US states is an example. I want to create a reusable component solving my problem.

What's the best way to create a custom component? I am a new bee to JSF.
1. Overriding HtmlSelectOneRadio (or)
2. Creating a new Custom component, overriding UIComponenBase - here i am not sure if i can include event listeners to the radio buttons.

Please advise.

Thanks in advance.
Liangfeng Ren

Joined: Jul 28, 2010
Posts: 7

MyFace does have a solution for this. Try to use its tomahawk tag <t:selectOneRadio> by setting layout property as "spread", then use <t:panelGrid> to layout the items.
Based on your requirement, the code can be as follows:

I agree. Here's the link:
subject: Chaging the layout (pageDirection/lineDirection) of the HtmlSelectOneRadio
It's not a secret anymore!