private static SubActionWrapper getSubActionWrapper(ActionMapping mapping, ActionForm form, ActionMapping subMapping,
HttpServletRequest request, int index) throws ClassNotFoundException,
IllegalAccessException, InstantiationException, InvocationTargetException {
String formName = subMapping.getName();
ActionForm subForm = getActionForm(subMapping, request);
FormBeanConfig formBean = mapping.getModuleConfig().findFormBeanConfig(formName);
String className = formBean == null ? null : formBean.getType();
if (className == null)
return null;
if (subForm == null || !className.equals(subForm.getClass().getName()))
subForm = (ActionForm) Class.forName(className).newInstance();
if ("request".equals(mapping.getScope()))
request.setAttribute(formName, subForm);
else
request.getSession().setAttribute(formName, subForm);
subForm.reset(mapping, request);
/*
* We dont want to try and populate all forms on a post, only the one
* that has requested it. For this the form must have a hidden parameter
* with the name of 'subForm' and the value being the form name to