Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

selectManyCheckBox within a panelgrid?

801427Oct 1 2009 — edited Oct 2 2009
Hi there

I am quite new to JSF and am currently struggling to get my long list of check boxes spread over a grid rather than in one line either horizontally or vertically off of the page. The list is in excess of 40 check boxes and I would to show them in a grid/table say 10 columns wide.

I have looked at panelGrid and have set this up, but I cannot work out how to display the checkboxes as I have described?

My code:

<h:panelGrid columns="8" footerClass="subtitle" headerClass="subtitlebig" styleClass="medium" columnClasses="subtitle,medium" style="width:100%">
<f:facet name="header">
<h:outputText value="Current Stop Words" />
</f:facet>
<h:inputText
<h:selectManyCheckbox id="StopWords" value="#{UserBean.stopWords}" >
<f:selectItems value="#{UserBean.stopWords}" />
</h:selectManyCheckbox>
/>
</h:panelGrid>

With my UserBean looking like this:

public List<SelectItem> getStopWords()
{
return f.stopWords;
}

Where f.stopWords is:

List<SelectItem> stopWords = new ArrayList<SelectItem>();

and is populated with:

private void setupStopWords()
{
for (int i = 0; i < exclusionWords.length; i++)
{
stopWords.add(new SelectItem(i,(String)exclusionWords));
}
}

To confirm, my checkbox works, I just want to know how to change the display of the checkboxes over multiple columns? If anyone could advise, or a URL link to a decent tutorial (I can't find one through google), or perhaps I am going about this the wrong way?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 30 2009
Added on Oct 1 2009
7 comments
1,396 views