Re: Dynamic generation of forms out of a config table in a database
Hi Tom, I saw a long thread last year on this mailing list discussing this subject. I can't remember the details but I do remember the person declared their success at the end. If you have a good search in the mail list archives on DynaActionForms and similar words, you are bound to find it. One restraint struts forces on you is that you can only have one form for an action, i.e. on form definition, one form in your action mapping and one form passed to your action as a parameter. But I think that you would only define the simplest dynaactionform in the struts-config and then add to it dynamically in the init or reset methods. You would have to write your own DynaActionForm child class that extends DynaActionForm to do that, and declare it as struts-config's type. Hope that helps, Adam PS You must be the Thomas Stockhammer I worked with on APLA? How's it going? (plz mail me off-list at adam.hardy at cyberspaceroad.com) On 02/11/2004 12:48 PM Stockhammer Thomas wrote: Hi all, In my application i want to generate dynamic forms, that means the number of controls placed on the forms depends on the entries in a config-tabel of a database. That means I can add a textbox to a database by adding a record to the config-table. Additionally i can show different forms to different users by adding roles to the config-table. The generation of the forms should be done by a servlet that converts xml-strings to forms... Does struts give any support for validation of such forms (DynaActionForms) and handle parameters via getXXX and setXXX Or is the only way to do validation in such a form via javascript and to handle parameter via request.getParameter(... Tank you Regards Tom -- struts 1.1 + tomcat 5.0.16 + java 1.4.2 Linux 2.4.20 Debian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Dynamic generation of forms out of a config table in a database
Hi Tom I use a quite similar approach, beside that I don`t use DynaActionForms, cause I read about some drawbacks (e.g. performence). Never the less what I did is I added a validation table (id/regexp). In my config-table I connect every form item to a regular expression. I then use IBatis to build a HashMap (table item regular expression) now I can use the ActionErrors validate() methode in my Form class to check if their are any errors. Advantage: Form class acts as a kind of DMZ. But as you use DynaActionForms you should check your Forms in your Action class, using the same approach. Hope that helps you a bit ... Oliver > Hi all, > > In my application i want to generate dynamic forms, that means the number > of > controls placed on the forms depends on the entries in a config-tabel of a > database. > That means I can add a textbox to a database by adding a record to the > config-table. Additionally i can show different forms to different users > by > adding roles to the config-table. > The generation of the forms should be done by a servlet that converts > xml-strings to forms... > Does struts give any support for validation of such forms > (DynaActionForms) > and handle parameters via getXXX and setXXX > > Or is the only way to do validation in such a form via javascript > and to handle parameter via request.getParameter(... > > Tank you > Regards > Tom > -- GMX ProMail (250 MB Mailbox, 50 FreeSMS, Virenschutz, 2,99 EUR/Monat...) jetzt 3 Monate GRATIS + 3x DER SPIEGEL +++ http://www.gmx.net/derspiegel +++ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]