Please unsubscribe me from the mailing list -----Original Message----- From: Paul Benedict [mailto:[EMAIL PROTECTED] On Behalf Of Paul Benedict Sent: Thursday, July 26, 2007 8:24 AM To: Struts Users Mailing List Subject: Re: Manipulating Collection in Struts Tag libs (options)
You should use EventAction to easily execute a different method in an Action. On your onclick handler, set a hidden form field -- it sounds like that could be considered a different method. Paul Oleg Konovalov wrote: > Hi, > > I am relatively new to Struts [using 1.3]. > > I need to create a form using Struts tag libs with 2 HTML select's > [lists], > connected to 2 DB tables, say allUsers and Admins, which would allow > to select Administrators from the list of AllUsers. > > So I will have 3 buttons: Add, Remove and Update. > Add - to add selected item(s) from AllUsers list to Admins list [if it is > not there already]; > Remove- to delete selected item(s) from Admins list; > Update - to save changes to Admins list to the Admins DB table. > > So roughly my JSP will looks something like that: > > <%@ page import="java.util.Collection" %> > > <html:form property="manageAdmins" action="/manageAdmins"> > > <table> > <tr> > <td> </td> > <td>All Users:</td> > <td> </td> > <td> </td> > <td> </td> > <td>Administrators:</td> > </tr> > <tr> > <td> </td> > > <td> > <html:select size="8" property="allUsers" multiple="true" > styleId="allUsersID"> > <html:options collection="AllUsersList" property="AllUsersId" > labelProperty="allUsers"/> > </html:select> > </td> > <td> </td> > <td> > <table> > <tr><img src="/images/btn_add.gif" alt="Add" name="add" border="0" > id="add" onClick="?"> > </tr> > <tr><img src="/images/btn_remove.gif" alt="Remove" name="remove" > id="remove" onClick="?"> > </tr> > <tr><img src="/images/btn_update.gif" alt="Update" name="update" > id="update" onClick="?"> > </tr> > </table> > </td> > <td> </td> > <td> > <html:select size="8" property="admins" multiple="true" > styleId="adminsID" onchange="getAdmins();"> > <html:options collection="AdminsList" property="AdminID" > labelProperty="admins"/> > </html:select> > </td> > </tr> > <tr> > </tr> > </table> > </html:form> > > So how do I manipulate these <html:options collection=AdminList...> > Struts > tags in order to implement Add, Remove, Update ? In onClick="..." ? > I mean, how do I manipulate Collection from <html:options> tag ? > Is it in JavaScript or in Java ? > Any other useful Struts tag for that [and to do Collection > synchronization with DB]? > Code snippets ? > > Sorry for the newbie question. > > Thank you in advance, > Oleg. > > --------------------------------------------------------------------- > 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] **************** CAUTION - Disclaimer ***************** This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely for the use of the addressee(s). If you are not the intended recipient, please notify the sender by e-mail and delete the original message. Further, you are not to copy, disclose, or distribute this e-mail or its contents to any other person and any such actions are unlawful. This e-mail may contain viruses. Infosys has taken every reasonable precaution to minimize this risk, but is not liable for any damage you may sustain as a result of any virus in this e-mail. You should carry out your own virus checks before opening the e-mail or attachment. Infosys reserves the right to monitor and review the content of all messages sent to or from this e-mail address. Messages sent to or from this e-mail address may be stored on the Infosys e-mail system. ***INFOSYS******** End of Disclaimer ********INFOSYS*** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]