Struts多模块间的跳转
(1)用SwitchAction,主要用于实现页面的跳转
(2)全局转发和局部转发,用于实现模块间的跳转
(3)采用html:link标签
web.xml:
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/manage</param-name>
<param-value>/WEB-INF/struts-config-manage.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>3</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>3</param-value>
</init-param>
<load-on-startup>0</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
struts-config.xml:
<action-mappings>
<action path="/switchdo" type="org.apache.struts.actions.SwitchAction"/>
<action path="/news"
scope="request"
type="com.struts.action.NewsAction" />
</action-mappings>
struts-config-manage.xml
<action-mappings>
<action path="/news"
parameter="method"
type="com.struts.manage.action.NewsAction">
</action>
</action-mappings>
进入manage模块的url为/switchdo.do?prefix=/manage&page=/news.do
用link方法进入
<html:link module="/manage" action="/news">或者
<html:link module="/manage" page="/news.do">
<html:link module="/manage" href="/news.jsp ">