• 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 Struts?

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to be able to dynamically generate form inputs (0-*) from DB. These input types can be any of the standard HTML Input types - which then need to be dynamically parsed and validated (with validation rules coming from DB). Is there an apparatus in Struts which I have not found as of yet that can perform all of these requirements dynamically?
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I suppose you'll have to resort to using the DynaActionForm instead of a regular ActionForm and implement your validation in Java instead of XML.
Do wait for a second opinion, though, since I'm far from a Struts guru...
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not really sure what you're asking for. Are you asking for the html form and associated ActionForm to be dynamically generated? are you asking for the contents of an ActionForm to be dynamically generated? Or are you asking for something else? When you say "form inputs" do you mean <input> tags (or the associated <html:input> tags)?

Maybe you can give us an example of exactly what it is you would like generated?
 
Bart Allen
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Today I have a Custom Tag on a JSP that dynamically created from 0 to n html inputs: <input> or <select> or <textarea> that I create from an ArrayList of HTMLInput objects that are loaded from a database. Upon post, I pull all of the parameters from the request object and, using the ID's of the Objects from the same ArrayList of HTMLInput objects, reassign what it's current value is based upon any modifications made. This is also where I perform any type of validation and a possible forward to the original entry form if there were errors.
I am currently in the process of trying to migrate my application to Struts, and have been able to figure out how to replace the static forms and their input, but have not figured out how to handle the dynamic aspects of my above defined issue ->
 
This is my favorite tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic