I'm developing an application using Struts2. My application is for online shopping. My task is updating and removing the shopping cart item. I have a JSP page and it has 4 text fields. I need to submit these text field's data to the Modify
action. Updating and removing submit buttons are in same page, same form. How do I determine which is the button I've clicked on JSP form?
My form is:
<s:form action="ModifyCart">
<s:textfield readonly="true" name="shoppingCart.item.id" label="Item Code" value="% item.id}"/>
<s:textfield readonly="true" label="Item Name" value="%{item.itemName}"/>
<s:textfield name="shoppingCart.qty" value="%{qty}"/>
<s:textfield readonly="true" label="Available Quantity" name="shoppingCart.item.qty" value="%{item.qty}"/>
<s:submit type="button" label="Update" name="submit"/>
<s:submit type="button" label="Remove" name="clear"/></s:form>
Important:
I need to submit all text field's data to the Action
class with every submit.