Hi, I upload a file in which I read information to fill a Collection of ValidatorForm object. The file is stocked in a DynaValidatorForm, who is called in the ActionMapping of the struts-config. The Collection of Form is fill in the DispatchAction of the ActionMapping. I validate the DynaValidatorForm but, after that, I want to validate each of the ValidatorForm object in the Dispatch Action.
I use the validate method from the ValidatorForm. But, the method call me a null pointer exception in the validate method when I do "validatorForm".validate(mapping,request). The code where is the error in the validate method is : super.validate(mapping,request). Somebody can give me an idea to validate each ValidatorForm in the same dispatch action of the ActionMapping without the exception. Sorry for my english, this isn't my native language :0). Any ideas are welcome ! Charles Gouin-Vallerand This is a snippet of my code : <action path="/createMasterFromFile" type="plateinv.actions.plate.MPCreateAction" name="plateCreationForm" parameter="method" validate="true" input="tiles.plate.master.create.option"> <forward name="createFromFile" path="tiles.plate.master.create.confirmationMP"/> <forward name="createFromFileMPDP" path="tiles.plate.master.create.confirmationMPDP"/> </action> public class MPCreateAction extends DispatchAction { ....... public ActionForward createFromFile(ActionMapping mapping,ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { DynaValidatorForm pcf = (DynaValidatorForm) form; //retrieve the file representation FormFile file = (FormFile) pcf.get("fileName"); ReadMP rmp = new ReadMP(file.getInputStream()); Collection collMP = rmp.read(); //Collection of MasterPlateForm Iterator it = collMP.iterator(); while(it.hasNext()) { MasterPlateForm mpf = ( MasterPlateForm ) it.next(); Enumeration enum = request.getAttributeNames(); mpf.validate( mapping, request ); // Where I call the validate method } return mapping.findForward("createFromFile"); } } public class MasterPlateForm extends ValidatorForm { ..... public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionMessages errors = super.validate(mapping,request); // This is the line where the null pointer exception is called String method = request.getParameter("method").toString(); if(method.equals("cancel")) { return null; } else { return (ActionErrors) errors; } } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]