Lachlan, I hope this helps - a bit long I know. ============ Below is what I have used. It shows multiple buttons & how to have data associated with the buttons. I hope this can be understood! I've seen other similar examples in archive butnot with the passing of data with the button, th way i do it may be a bit flakey. Keith.
=============== Code for jsp - Redisplay Button & Maint Button that passed key value to form bean. property= gives names of properties in form bean If user presses maintButton struts calls setMaintButton(key) on the form bean. ----- <html:submit property="redisplayButton"> <bean:message key="Biff1LinkList.jsp.literal.redisplayButton"/> </html:submit> <% String key = listItem.getLinkIDAsString(); %> <html:submit property="maintButton" value="<%= key %>"> <bean:message key="Biff1LinkList.jsp.literal.redisplayButton"/> </html:submit> ===================== In Form bean ----- boolean redisplayButton; boolean maintButton; String maintButtonData; /** * RedisplayButton - ActionServlet calls this if it was pressed */ public void setRedisplayButton(String sss) { //dbmd("setRedisplayButton: value passed="+ sss); redisplayButton = true; } /** * Action class uses this to see if this button was pressed */ public boolean isRedisplayButton() { return redisplayButton; } /** * maintButton - ActionServlet calls this if it was pressed * Val. passed in is from value= parm on <html:submit tag. */ public void setMaintButton(String sss) { maintButton = true; maintButtonData = sss; } /** * action class uses this to see if this button was pressed */ public boolean isMaintButton() { return maintButton; } /** * action class uses this to get the key * if this maintButton was pressed */ public String getMaintButtonData() { return maintButtonData; } ====================== In Action class ----- if (myForm.isRedisplayButton()) { // // redisplay page (use change selection/sort parms) // } else if (thisForm.isMaintButton()) { // // get the key value (from value= parm // of the <html:submit tag. // String selectedLinkID = myForm.getMaintButtonData(); ------------- end of keiths example ======================================= --- Nathan Anderson <[EMAIL PROTECTED]> wrote: > I know that people have done this before, so I'm > sure someone can help you > out [or you can find an answer in the mail archive]. > But I was thinking > about this today, and I wondered what would happen > if you create a "submit" > property in your form bean, and then give each > submit button a different > value. > > Someone must have tried that... what happens? > > Nathan Anderson > > -----Original Message----- > From: Lachlan Holmes > [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, December 12, 2001 4:26 PM > To: Struts Users Mailing List > Subject: multiple buttons on a form > > > Is there a way to have multiple submit buttons on a > form and be able to tell > which button was pressed in the following action? > > Regards, > Lachlan > > > -- > To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>