Struts2 CheckBoxList label (Form label)

Source: Internet
Author: User

CheckBoxList label

This tab can create multiple check boxes at once, which are based on the collection specified by the List property

To generate multiple check boxes and use common properties.

This label has two common properties: Listkey: The value that specifies a property in the collection element as a check box.      If the collection is a map, you can use Key-value, respectively, for the key-value of the map as the value of the check box. ListValue: A label that specifies a property in the collection element as a check box. If the collection is a map, you can use Key-value to label the Key-value of the map respectively as a check box.

eg

<s:form>
<!--use a simple collection to generate multiple check boxes;
<s:checkboxlist name= "a" label= "Please select your favorite book"
  labelposition= "Top" list= "{' Struts2 authoritative guide ',
  ' Lightweight Java Business application ', ' Ajax treasure based on Java EE '}"/>
<!-- Use a simple Map object to generate more than one check box
  Use the value of the Map object's key (book title) As the check box,
  Use the value of the Map object (publication time) as the label for the check box;
<s: CheckBoxList name= "B" label= "Please select the publication date you want to select"
 labelposition= "Top"  list= "#{' Struts2 authoritative guide ': ' October 2007 ',
  ' Lightweight Java Business application ': ' 2007 month April ',
  ' Ajax treasure based on Java EE ': ' June 2007 '} '
 listkey= ' key '
  Listvalue= "Value"/>
<!--creates a JavaBean object and puts it into the stack context;
<s:bean name= "Lee. Bookservice "id=" BS/>
<!--use multiple JavaBean instances in a collection to generate multiple check boxes
  Use the Name property in the collection element as the label for the check box
  Value-->
<s:checkboxlist name= "B" label= "Please choose your favorite book"
 labelposition= "top" using the Author property as the checkbox in the collection element;
 list= #bs. Books
 listkey= "author"
 listvalue= "name"/>
</s:form>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.