• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Struts : Dynamic HTML form parameters

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a requirement where the HTML form input paramater names are dynamically generated and hence I cannot have them as property in ActionForm bean. How can I handle this in Struts framework? The input field I am trying to use will of type select.
 
sharp shooter, and author
Posts: 1913
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Moving this to the frameworks forum...
Simon
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do map-backed forms in Struts 1.1 solve your problem?? They are forms which have have maps that carry the properties. Hence the number of request parameters can vary.
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
DynaForms are configured in struts-config and can therefore only contain specified (number of) parameters.
What you can do, is write your own ActionForm containing a single map and populate this map yourself by writing a utility method for this.
Unfortunately, you will not be able to use Struts up to its max, but that's a small price to pay for still being able to use dynamic properties.
Ruud.
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After reading Ruud's response, I was just curious as to how one would be able to populate a map of attribute/value pairs when the methods on an ActionForm are meant to be used by Struts using relfection. You would still somehow need methods that are setters and getters for particular attribute names, no?
 
My favorite is a chocolate cupcake with white frosting and tiny ad sprinkles.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic