[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    Re: multiple submit buttons
From:       Michael Jouravlev <jmikus () gmail ! com>
Date:       2005-09-30 19:03:37
Message-ID: 1db115340509301203q1d6fc412gd506d4eb6ecbf9ed () mail ! gmail ! com
[Download RAW message or body]

On 9/30/05, Warren Bell <warren@clarksnutrition.com> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic