This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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. Thanks, Rohit
We have been using Struts for a little of a year and I ran into this same problem some time ago. Truthfully, I never solved it. I couldn't find a way to make Struts do this, so for the one page that uses it, I just "punted" and wrote a servlet to do it. The closest thing that I found is the DynaActionForm, which just allows you to specify all of the fields in the struts-config.xml file and not have to write your own validation bean ... but you have to know your fields. In your case, you don't know then ahead of them or they may be different each time. Basically what I did was pass the name, type, and default values as hidden variables to my validation servlet and let it handle the rest. Struts is not well suited to some tasks. I'll keep reading this forum though to see if someone else knows how to do it. I'm willing to change, but for now, what I have works. Paul
Originally posted by Rohit Poddar: 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. Thanks, Rohit
Though newbiw to Struts and just two days back I understand power of struts [using struts tag in jsp. Wow its really seperate view from logic, now we need one good editor which can color differently struts tags.] If you know max number of select then you can have member variables in Form beanm though most of them will be null. Else you can give same name to all select and then can have one array as member var of FormBean.
"Thanks to Indian media who has over the period of time swiped out intellectual taste from mass Indian population." - Chetan Parekh
Joined: Aug 18, 2001
Thanks. I like the idea of same name and array.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com