web.xml
<init-param> <param-name>config/advinfo</param-name> <param-value>/WEB-INF/struts-advinfo.xml</param-value> </init-param>
struts-advinfo.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"> <struts-config> <!-- 数据源 --> <data-sources> </data-sources> <!-- 表单 Bean --> <form-beans> <form-bean name="AdvInfo" type="struts.advinfo.forms.AdvInfo"> </form-bean> </form-beans> <!-- 全局异常 --> <global-exceptions> </global-exceptions> <!-- 全局转发 --> <!-- 操作映射 --> <action-mappings> <action path="/info" type="struts.advinfo.action.InfoAction" name="AdvInfo" scope="request"> <forward name="advinfo" path="/advinfo_form.jsp"> </forward> <forward name="print" path="/print.jsp"> </forward> <forward name="success" path="/success.jsp"> </forward> <forward name="failed" path="/failed.jsp"> </forward> </action>
</action-mappings> <!-- 消息资源 --> <message-resources parameter="struts.advinfo.resources.ApplicationResources"/> </struts-config>
InfoAction.java
public class InfoAction extends Action { @Override public ActionForward execute(ActionMapping mapping, ActionForm form, ServletRequest request, ServletResponse response) throws Exception { // TODO Auto-generated method stub return super.execute(mapping, form, request, response); } }
AdvInfo.java
public class AdvInfo extends ActionForm { //bean }