If each of the buttons is a Submit button, and you have each row of the table wrapped in a separate form, you can put a <s:hidden> within each form, and store/provide the ID of the row within it.
jk On Fri, Aug 29, 2008 at 11:22 AM, Ylva Degerfeldt <[EMAIL PROTECTED] > wrote: > Hi everyone, > > I have a List of POJOs that I've created, and for every POJO in the > list I'm displaying some UI components corresponding to the properties > of the POJO (textfields and select fields et.c.). I also have some > submit buttons that belong to each row (and indirectly to each POJO), > like "Edit", "Save" and "Remove" buttons. My corresponding Action has > a property for the List and it receives its values the way it should. > > My problem is that I need some way to tell the Action which of the > buttons that had been pushed (which one of the "Edit" buttons for > instance), and I don't know how to do that. To be more exact, I'd like > some way to return the #state.index of that iteration/row when a > specific button has been pushed. > > I'm also using the "method" tag for calling different methods on the > Action depending on which of the three buttons that was pushed, so > that's not a problem. > > I've tried to find more information about the s:submit but I didn't > find anything in "Struts 2 in Action" and the Struts 2 API docs aren't > explaining much either. > > I've tried using the "name" and "value" attributes like for other UI > components, like: > > <s:submit name = "Edit" value = "%{#state.index}" key = > "caption.editbutton" method = "Edit"/> > > but that only caused the index value to be the caption of the button. > So it looks like "value" means something else for submit components > than for other UI components. (It turns into the caption, If a "value" > is specified..) > > I've also checked the parameter names I receive from the action, but > apart from the different properties of the List I only receive > "method: Edit" (when an "Edit" button has been pressed). Though I > recall that when not using Struts you could receive the name of the > button as a request parameter, so how do I do that with Struts 2 - and > connect a value to it? > > Maybe I could use the "onclick" attribute of s:submit but I don't know > the syntax for sending a value to the Action there. (Isn't that > javascript?) > > Can somebody please help me with this? > > Thanks in advance! > > /Ylva > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Jim Kiley Technical Consultant | Summa [p] 412.258.3346 [m] 412.445.1729 http://www.summa-tech.com