aspose file tools*
The moose likes Struts and the fly likes Dynamic Struts? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Dynamic Struts?" Watch "Dynamic Struts?" New topic
Author

Dynamic Struts?

Bart Allen
Greenhorn

Joined: Dec 19, 2003
Posts: 21
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?


SCJP, SCWCD, SCBCD, SCJD
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
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...


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Jason Menard
Sheriff

Joined: Nov 09, 2000
Posts: 6450
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

Joined: Dec 19, 2003
Posts: 21
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 ->
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Dynamic Struts?