I understand the JSP side of this eqation as you wrote it, although I should have said I was looking for a solution that doesn't use Struts taglibs because I try to avoid them at all costs, but that aside...
I'm still unclear however on what the ActionForm does... Using this concept, do I HAVE to use the LazyActionForm you wrote? I'd prefer to only use things that are built-in to Struts, and unless I'm missing it in the docs, that's not. The question I'm getting at is that, like I said, the JSP code you wrote makes sense, but what will put the submitted parameters into the collection in the ActionForm when the submission happens? That's the part I don't see. Thanks for your help! -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com On Thu, September 30, 2004 1:51 pm, Niall Pemberton said: > You simply need a property in your ActionForm that returns a collection of > "skill" beans and used the "indexed" attribute on the <html> tags. The > "isssue" that most people have problems with is when using a "Request" > scope > ActionForm you need to populate your collection with the right number of > skill beans - the way to handle this is some kind of "lazy list" > processing > for that property. Search the archives on indexed properties and lazy list > processing. > > In your jsp... > > <logic:iterate name="skillsForm" property="skills" id="skills"> > <html:text name="skills" property="skillid" indexed="true"/> > <html:select name="skills" property="skillLevel" indexed="true"> > <html:option value="1">Low</html:option> > <html:option value="2">Medium</html:option> > <html:option value="3">High</html:option> > </html:select> > </logic:iterate> > > The trick is to name the "id" attribute to the same as the property in the > form which returns the collection, that way Struts will generate something > like: > > <input type="text" name="skills[x].skillid value=".."/> > > > The lazy ActionForms I wrote have the lazy list behaviour built in.... > > http://www.niallp.pwp.blueyonder.co.uk/#lazydynabean > > Niall > > > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Thursday, September 30, 2004 6:19 PM > Subject: How to handle multiploe unknown form fields > > >> I have an interesting situation, one that has never come up before, and > I'm unsure how to deal with it... >> >> Imagine you have some records from a database representing various >> skills > (i.e., HTML, Javascript, J2EE, etc.). Each has a SkillID associated with > it. >> >> You create a JSP that lists each skill with a drop-down next to it. The > drop-down allows the user to select their skill level for each skill. >> >> When the user hits Save, you need to update all the skills for that >> user. >> >> That's the scenario. Here's the question... Each drop-down is given the > name of the SkllID. But how do you write an ActionForm for that? >> >> Since the database can be expanded to include new skills at any time, >> it's > impractical to add getters and setters for each SkillID, and in fact > breaks > low coupling goals anyway. >> >> Is there a standard way of accepting what kind of amounts to an array of > inputs from a form and getting it into an ActionForm in some way (maybe as > an ArrayList or something?). >> >> TIA! > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]