• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Dynamic Struts?

 
Bart Allen
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • 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?
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • 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...
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • 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
  • 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 ->
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic