FileDocCategorySizeDatePackage
WackyWizardForm.javaAPI DocExample2024Thu Jun 10 02:37:04 BST 2004com.oreilly.strutsckbk.ch05

WackyWizardForm

public class WackyWizardForm extends ActionForm
author
Bill Siggelkow TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Fields Summary
private int
page
private String[]
pageFormNames
private ActionForm[]
pageForms
Constructors Summary
public WackyWizardForm()

	
	  
		pageFormNames[0] = "FirstPageForm";
		pageFormNames[1] = "SecondPageForm";
	
Methods Summary
private ActionFormcreateActionForm(ModuleConfig mconfig, java.lang.String formName)

	  FormBeanConfig fbconfig = mconfig.findFormBeanConfig(formName);
	  ActionForm form = null;
  	try {
		  if (fbconfig.getDynamic()) {
		  	DynaActionFormClass dafc = DynaActionFormClass.createDynaActionFormClass(fbconfig);
				form = (ActionForm) dafc.newInstance();
		  }
		  else {
		  	form = (ActionForm) Class.forName(fbconfig.getType()).newInstance();
		  }
  	}
  	catch (Exception e) {
  		e.printStackTrace();
  	}
	  return form;
	
public intgetPage()

		return page;
	
public voidreset(ActionMapping mapping, javax.servlet.http.HttpServletRequest request)

		super.reset(mapping, request);
	  ModuleConfig mconfig = mapping.getModuleConfig();
		for (int i=0; i<pageFormNames.length; i++) {
			pageForms[i] = createActionForm(mconfig, pageFormNames[i]);
		}
	
public voidsetPage(int page)

		this.page = page;
	
public ActionErrorsvalidate(ActionMapping mapping, javax.servlet.http.HttpServletRequest request)

		ActionErrors errors = super.validate(mapping, request);
		for (int i=0; i<=page; i++) {
			errors.add( pageForms[i].validate(mapping, request) );
		}
		return errors;