LookupDispatchAction 用法

1.html 代码
 <html:form action="/test" method="post">
     <html:submit property="action">
            <bean:message key="toone"/>
      </html:submit><br>
     <html:submit property="action">
            <bean:message key="totwo"/>
     </html:submit>
  </html:form>

2.java 代码
public ActionForward one(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response) 
{
    TestForm testForm = (TestForm) form;
    return mapping.findForward("toone");
} 
public ActionForward two(ActionMapping mapping, ActionForm form,
   HttpServletRequest request, HttpServletResponse response) 
{
    TestForm testForm = (TestForm) form;
    return mapping.findForward("totwo");
}
 @Override
 protected Map getKeyMethodMap() 
{
   Map map = new HashMap();
   map.put("toone", "one");
   map.put("totwo", "two");
   return map;
 }

你可能感兴趣的:(java,html)