<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %> <html:link action="/Sort">Sort</html:link>
<a href="/chainapp/Sort.do">Sort</a>
... and clicking on that link will cause the 'sort' chain to be executed by way of ...
<action path="/Sort" type="org.apache.struts.actions.ChainAction" scope="request" parameter="sort" > <forward name="success" path="/pages/display.jsp"/> </action>
... and parameter="sort" matches up with the name of the chain in the catalog ...
<context-param> <param-name>org.apache.commons.chain.CONFIG_CLASS_RESOURCE</param-name> <param-value>catalogs/webapp-catalog.xml</param-value> </context-param> <listener> <listener-class>org.apache.commons.chain.web.ChainListener</listener-class> </listener>
... which parses the catalog below ...
<?xml version="1.0" ?> <catalog> <command name="check" className="net.wsmoak.chain.commands.CheckList"/> <chain name="sort"> <command className="net.wsmoak.chain.commands.CheckList"/> <command className="net.wsmoak.chain.commands.SortAscending"/> <command className="net.wsmoak.chain.webapp.Succeed"/> </chain> </catalog>
... the Succeed command puts a 'success' ActionForward in the context, which ChainAction retrieves and returns as the result.