• 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

Dynamic fields in Struts ActionForm?

 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI Friends
i will explain the scenario first
i have a page, in that i need to display questions and options for that question.
questions are dynamic, how many i have in database, i need to display all.
and options for a question also dynamic , means one question may have 2 options and other can have 10 options.

For this i created one Question Bean


options Bean is


in Struts-config.xml


in jsp


but it is throwing Exception


How to say in struts-config.xml that a form-property contains another bean and how to solve this problem.
Could any body explain me please?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The <form-property> element is only used if the bean type is DynaActionForm. Since you're not using DynaActionForm, this element is ignored.

I'd suggest simply defining a property in your ActionForm that is a List of QuestionBeans with corresponding getters and setters. If you plan on creating input fields for each question, you will also need an indexed getter for. Example:


You can then use indexed properties to access each question. For more information on how to use indexed properties, see question 7 of this forum's FAQ.
 
reply
    Bookmark Topic Watch Topic
  • New Topic