怎样使用标签和strust区别在一个form中的2个按钮的行为
前台代码:
<html:form action= "/testAction.do " method= "post ">
.........
<html:submit property= "action " value= "增加 ">
<bean:message key= "button.add "/> </html:submit>
<div align= "center "> </div> </td>
<td height= "25 "> <div align= "center ">
<html:submit property= "action " value= "修改 ">
<bean:message key= "button.updata "/> </html:submit>
</div> </td>
testAction的代码:
package ems.struts;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.LookupDispatchAction;
public class testAction extends LookupDispatchAction {
protected Map getKeyMethodMap()
{
HashMap map=new HashMap();
map.put( "button.add ", "add ");//button.delete,按钮的 message key
map.put( "button.update ", "update ");
return map;
}
public ActionForward add(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
{
System.out.println( "add ");
return null;
}
public