Struts lookupDispatchAction基于Map和资源文件的请求分发

 protected Map getKeyMethodMap() {
  HashMap<String,String>  keys=new HashMap();
  keys.put("operator.submit.login","login");
  keys.put("operator.submit.delete","delete");
  return keys;
 }

 1.创建form和action,action继承抽象类LookupDispatchAction
2.实现未实现的抽象方法

3.表单的配置
  

<form action="login.do">
    <input type="submit" name="operator" value="login">
    <input type="submit" name="operator" value="delete">
   </form>

 4.struts-config.xml的配置
 parameter="operator"
5.资源文件的配置
 operator.submit.login=login
 operator.submit.delete=delete
6.测试

你可能感兴趣的:(xml,struts)