I am having a problem with ActionForm. Please help me out, because I have been trying to resolve this problem for the past 4 days without getting any solution for it. Thank you so much!
I defined the form in the struts-config.xml as: <form-beans> <form-bean name="programGroupForm" type="xmps.presentation.action.form.ProgramGroupForm"/> </form-beans> The 3 actions that use the form-bean are: <action path="/admin/createProgramGroup" type="xmps.presentation.action.EditProgramGroup" name="programGroupForm" scope="request" validate="false"> <forward name="success" path="/pages/programgroup/edit.jsp"/> <forward name="failure" path="/pages/programgroup/error.jsp"/> </action> <action path="/admin/saveProgramGroup" type="xmps.presentation.action.SaveProgramGroup" name="programGroupForm" scope="request" validate="false"> <forward name="success" path="/pages/programgroup/save.jsp"/> <forward name="failure" path="/pages/programgroup/error.jsp"/> </action> <action path="/admin/selectProgramGuide" type="xmps.presentation.action.SelectProgramGroupItem" name="programGroupForm" scope="request" validate="false"> <forward name="success" path="/pages/programgroup/search.jsp" /> <forward name="failure" path="/pages/programgroup/error.jsp" /> </action> Everthing works perfectly fine, until a call was made to connect to another webserver to retrieve some pages in one of the action's execute() method. For instance: in action SelectProgramGroupItem public ActionForward ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { ..... ProgramGroup[] groups = ProgramGroupService.getService().search(searchText)); //this is a HTTP client call to another web-server to retrieve the program groups for a searchText ..... } After this point, all the returned values from calling the ProgramGroupForm getter methods are "null" (regardless whatver action it was in). It seems like the way Struts handling the ActionForm got messed up. Such as: in action EditProgramGroup public ActionForward ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { ProgramGroupForm pgForm = (ProgramGroupForm)form; pgForm.getType(); //returned null pgForm.getDescription(); //returned null //however, if I tried to access the parameter value directly, the values are there. request.getParameter("type"); //returned correct value request.getParameter("description") //returned correct value ..... //I tried to work around this by setting the values in the ProgramGroupForm manually. pgForm.setType(request.getParameter("type")); pgForm.setDescription(pgForm.getDescription()); ..... return mapping.findForward("success"); } Despite that I set the values in the setter methods manually, in the JSP pages that it forwarded to, when I tried to access the properties, the returned values are still null <html:text propperty="type" size="50" /> <html:textarea name="programGroupForm" property="description" rows="5" cols="50" /> Perhaps, I dont' know exactly how the ActionForm works in Struts. I was expecting the ProgramGroupForm object in JSP is the same one that I see in the Action's execute. If it is, then why I can't retrieve the property's value in the JSP page, after even I manually set it in the Action's execute method. Regards, -Vince --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]