On 9/30/05, Warren Bell <[EMAIL PROTECTED]> wrote: > I am sure this question has been asked before, but I don't know what > keywords to use to search for it. I have a table where each row has a hidden > field and two submit buttons, a "buy now" and a "Add to shopping cart". A > typical layout for most e-commerce sites. How do I figure out which item > needs to be added to the shopping cart without sending each item on the page > with the request? Is there a good example of how this should be done?
The simplest choice is to use a separate HTML form for each row. You can submit each form to a different address, if you want. But more likely, you would submit all forms to one address, providing an item ID. You would have a hidden field with item ID in each form, which would be automatically submitted when form is submitted. You do not need to send a whole item with request, but you need to send at least an item ID, so you can send it back to the server when you submit a form. Here is live example: http://www.superinterface.com/strutsdialog/crudactionlite.do If you look at the source code, you will see that each row is a form with a hidden "itemId" field: <input type="hidden" name="itemId" value="73184"> Also, check out DisplayTag decorators: http://www.displaytag.org/example-decorator-link.jsp Michael. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]