---
title: "Struts1.2 中的DispatchAction"
author: "dampce032"
date: "2011-04-18T21:43:25Z"
tags: ["HTML", "Struts", "XML"]
categories: ["企业架构"]
slug: "struts1-2-dispatchaction"
draft: false
lastmod: "2011-04-18T23:19:47Z"
id: 1007373
url: "https://dampce032.iteye.com/blog/1007373"
---

Struts1.2 中的DispatchAction

一、DispatchAction？

一个action如果单单处理如增加等一个请求，那么会造成Action类的臃肿。DispatchAction可以在一个Action中处理不同的请求

**二、使用**

1.Action类继承DispatchAction

2.在struts-config.xml中配置用于给用于指定调用该action中的何方法的 parameter="method",其中method是指定页面请求时需对应的参数名

3.页面调用

3.1form表单

&lt;html:form action="/user?method=add"&gt;

3.2 a标签

&lt;html:link action="user.do?method=list"&gt;

附件为使用了DispatchAction的一个比较全使用了strut1.2知识的demo