Software Development

JSF – selectManyCheckbox example

[wp_ad_camp_5]

This post shows sample codes that uses JSF html:selectManyCheckbox that allows users to select one or more items before submitting the form or page.

Requirements

Stuff used in this post.

  • JSF 2.2
    • javax.faces-2.2.8.jar
  • JDK 8

JSF Managed Bean

This is our managed bean is a Java class annotated with @ManagedBean. The 3 important piece of codes here are:

  1. @ManagedBean
  2. Default public no-arg constructor
  3. Setter and getter methods

For this post, our class has only one property – a list of strings.

[wp_ad_camp_4]

First Page – Request

The first page is where the checkboxes are displayed. Users selects one or more items and hits the Submit button to go to the response page.

[wp_ad_camp_3]

Second Page – Response

This page displays the selected letters from the first page.

[wp_ad_camp_2]

Testing

Request Page

[wp_ad_camp_1]

Response Page

Loading

Got comments or suggestions? We disabled the comments on this site to fight off spammers, but you can still contact us via our Facebook page!.


You Might Also Like