![JAR search and dependency download from the Maven repository](/logo.png)
com.mockrunner.example.struts.ShoppingCartAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockrunner-jdk1.3-j2ee1.3 Show documentation
Show all versions of mockrunner-jdk1.3-j2ee1.3 Show documentation
Mockrunner is a lightweight framework for unit testing applications
in the J2EE environment. It supports servlets, filters, tag classes
and Struts actions. It includes a JDBC a JMS and a JCA test
framework and can be used to test EJB based applications.
The newest version!
package com.mockrunner.example.struts;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.LookupDispatchAction;
/**
* This simple LookupDispatchAction
returns
* different forwards, depending on the called handler method.
* Demonstrates how to test a LookupDispatchAction
.
*/
public class ShoppingCartAction extends LookupDispatchAction
{
protected Map getKeyMethodMap()
{
Map map = new HashMap();
map.put("button.add", "add");
map.put("button.order", "order");
return map;
}
public ActionForward add(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception
{
return mapping.findForward("add");
}
public ActionForward order(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception
{
return mapping.findForward("order");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy