• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Multibox using bean

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a bean efine that contains an arraylist. Each object in arraylist contains an accountId, which is displayed and exemptStatus, which represents the check in the checkbox. Could someone show me how I can get the check to show-up in the checkbox using multibox and an arraylist?


<bean efine id="exemptBtnData" name="erateExemptStatusForm" property="btnListToDisplay" type="java.util.ArrayList"/>


<logic:iterate id="exemptBtns" name="exemptBtnData" type="com.sbc.ctf.model.ExemptStatusList" >
<bean:write name="exemptBtns" property="accountId"/>
<html:multibox name="erateExemptStatusForm" property="selectedBtns">
<bean:write name="exemptBtns" property="exemptStatus"/> </html:multibox>
</logic:iterate>
 
Rocko Smith
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know the above description might be confusing. Let me rephrase my question;

I have a bean defined as an arraylist. I want to know if I can use an arraylist with the multibox or does it need to be a string array?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While you can use an Arraylist to create the checkboxes using <html:multibox>, it's important that the "property" you specify be a String array. In your example, selectedBtns must be a String array.

For what you want to do, I'd suggest using <html:checkbox> instead of <html:multibox>. Use an indexed property to identify the checkbox.

This link tells you how to use indexed properties. Note that while using indexed properties, you must either put the ActionForm in session scope, or use a Lazy Initialization technique with the ActionForm bean.
[ May 30, 2006: Message edited by: Merrill Higginson ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic