The code below is abbreviated is some cases to show only the relevant information.
method-servlet.xml
--------------------------
Code:
<!ENTITY path.secure.rootpath "/secure">
<!ENTITY path.secure.index "&path.secure.rootpath;/index.htm">
<!ENTITY path.cart.addtocart "&path.secure.rootpath;/cart/addtocart.htm">
Code:
<bean id="shopcartController" class="com.method.web.ShopCartFormController">
<property name="sessionForm">
<value>false</value>
</property>
<property name="commandName">
<value>shopcart</value>
</property>
<property name="commandClass">
<value>com.method.bo.ShopCart</value>
</property>
<property name="methodDBFacade">
<ref bean="method" />
</property>
</bean>
Code:
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="interceptors">
<list>
<ref bean="localeChangeInterceptor" />
</list>
</property>
<property name="mappings">
<props>
<prop key="&path.index;">homeController</prop>
<prop key="&path.browse.search;">searchController</prop>
<prop key="&path.cart.addtocart;">shopcartController</prop>
</props>
</property>
</bean>
controller:
---------------------------
Code:
public class ShopCartFormController extends AbstractFormController {
/** Logger for this class and subclasses */
protected final Log logger = LogFactory.getLog(getClass());
private MethodDBFacade methodDBFacade;
public void setMethodDBFacade(MethodDBFacade facade) {
methodDBFacade = facade;
}
protected boolean isFormSubmission(HttpServletRequest arg0) {
return true;
}
protected ModelAndView processFormSubmission(HttpServletRequest request, HttpServletResponse arg1, Object arg2, BindException arg3) throws Exception {
Map hm = WebUtils.getParametersStartingWith(request, "ck");
logger.debug("hm in shopcart onSubmit is: "+hm);
if (hm!=null)
logger.debug("hm size: "+hm.size());
return new ModelAndView("search");
}
form
------------------------
Code:
<form action="$rc.getContextPath()/secure/cart/addtocart.htm" method="post" name="shopcart">
<td width="1%" align="center"><input id="Common_rowSelect1" type="checkbox" name="ck_5A1930FC8A86706685256BF40049B60E" value="5A1930FC8A86706685256BF40049B60E"></td>
<INPUT NAME="addtocart" TYPE="image" SRC="/images/buttons/addtobasket.gif" align="absmiddle" width="115" height="30">
</form>