DispatchAction,LookupDispatchAction,MappingDispatchAction
1) DispatchAction就是在struts-config中用parameter参数配置一个表单字段名,这个字段的值就是最终替代execute被调用的方法. 例如parameter="method"而request.getParameter("method")="save",其中"save"就是MethodName。struts的请求将根据parameter被分发到"save"或者"edit"或者什么。但是有一点,save()或者edit()等方法的声明和execute必须一模一样。
2) LookupDispatchAction继承DispatchAction, 用于对同一个页面上的多个submit按钮进行不同的响应。其原理是,首先用MessageResource将按钮的文本和ResKey相关联,例如button.save=保存;然后再复写getKeyMethodMap(), 将ResKey和MethodName对应起来, 例如map.put("button阅读全文>
发表于 @ 2007年06月04日 15:57:00|评论(loading...)|举报|收藏