Oleg Konovalov wrote:
I have a bunch of rows [ArrayList of ValueObject Classes], and a button corresponding to each row. I populate the data from each row in forEach loop. User is supposed to click on one of these buttons [selecting one row to process], and onClick event I need to pass the rowId of the to the new Action ["notify"] in Action class. Sounds like a trivial task ? I am just not sure how to implement that correctly in Struts, pretty new to Struts.
Depends on what you expect to happen when they click the button... is the entire page refreshed, or are you thinking of doing some AJAX here? If the entire page is going to refresh, I'd simply make each row its own form and have the button be a regular submit button. Add a hidden field to each form that has the rowId as its value. Simple, standard, will work just fine. Alternatively, if you don't like multiple forms, then have a single hidden form field which again is the row Id, then onClick of the button do:
this.form.rowId.value='${list.rowId}';this.form.submit(); If your thinking AJAX here, then there's all sorts of ways you could do it.
Maybe I should use <html:submit src=pic.gif onclick="form.action='action.do?command=notify'" * value*="${list.rowId}"> instead of HTML <input type=image...> ?
Yes, in theory that could work, but I think it's a bit too complicated. Again, if your not thinking AJAX here, just do a plain form submission, it's the best answer. If you DO want to do AJAX, let us know and we can suggest ways to go about it.
Dave's suggestions are good too, it just comes down to how you really want this to work.
TIA, Oleg.
Frank -- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com AIM/Yahoo: fzammetti MSN: [EMAIL PROTECTED] Author of "Practical Ajax Projects With Java Technology" (2006, Apress, ISBN 1-59059-695-1) and "JavaScript, DOM Scripting and Ajax Projects" (2007, Apress, ISBN 1-59059-816-4) Java Web Parts - http://javawebparts.sourceforge.net Supplying the wheel, so you don't have to reinvent it! --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]