You can try to have an ArrayList/HashMap of HasMaps representing the page/form. 
 Each Hashmap can hold the Question/Answer set.

Please refer to Mapped Properties for more info
        1. http://struts.apache.org/1.2.9/faqs/indexedprops.html
        2. http://struts.apache.org/1.2.9/userGuide/building_view.html#indexed

Pass some flag to decide on wheter to display checkbox or radiobuttons. Hope 
this will help.

Thanks and Regards,
Thomas Joseph
  ----- Original Message ----- 
  From: Jakub Milkiewicz 
  To: Struts Users Mailing List 
  Sent: Thursday, July 20, 2006 4:26 PM
  Subject: dynamic checkboxes and radio buttons in one group


  Hi
  I have a problem with dynamic form handling. On a page i want to present a
  list of questions. For each question you need to make an answer, but answer
  widgets can be represented as 2 radio buttons or single checkbox. Initially
  all answer widgets should be blank - checkboxes unchecked, radio buttons
  unselected.
  The problem is that i do not know explicite how many questions i need to
  dispaly and what kind of answer i need to present i.e. show a checkbox or 2
  radiobuttons. Number of questions, text of each question and decision to
  show answer widget as 1 checkbox or 2 radiobuttons is read from some kind of
  configuration in action that presents me the page.
   I would like to have all these answers stored in my action form mapped to a
  single property as some kind of collection (array or list). Also my
  actionform is stored in session scope - i know i need to appropraitely reset
  the form.
  I searched on the web and i found to use multibox for a group of checkboxes.
  The problem is that i do not know if i need to present a checkbox or 2
  radiobuttons as single answer widget.
  All i would like to get is some kind of collection or array in the
  form={"yes",null,null,"yes","no",null}
  It means that the answer for question 0, 3, 4  was made but answer widget
  for question  1 , 2, 5 was left blank.
  Does someone have any idea??

Reply via email to