Hi all
I have a very annoying problem with removing a form bean: I'm working with WSAD v6.0 (RAD v6.0) and struts v1.2.4 When creating a new Item I call EditItemAction (mehod create) The ItemForm is created and then passed to editItem.jsp >From there it arrives to SaveItemAction (method create) and if the item was successfully saved it is returned with a success message to EditItemAction (method create) - to enable the user to create another item. The problem is that when I get to the input form the second time - it still shows the data of the first Item that was created before, i.e. the form bean is not removed. The scope in the struts-config is request and I also checked by printing mapping.getScope() which was also request. There is no such attribute in the session scope - I checked that. I saw that after doing - request.removeAttribute(mapping.getAttribute()); - the attribute (i.e. the form) was is actually removed, but when it is forwarded to the EditAction to create another new Item - it somehow finds the previous form bean. here's the relevant code from struts-config file: <action path="/EditMsvItem" type="org.nite.mashovweb.actions.EditMsvItemAction" name="MsvItemForm" scope="request" validate="false" parameter="action"> <forward name="success" path="/editMsvItem.jsp"> </forward> <forward name="failure" path="/Error.jsp"> </forward> </action> <action path="/SaveMsvItem" type="org.nite.mashovweb.actions.SaveMsvItemAction" name="MsvItemForm" scope="request" input="/editMsvItem.jsp" parameter="action"> <forward name="search" path="SearchMsvItem.do"> </forward> <forward name="update_failure" path="/editMsvItem.jsp"> </forward> <forward name="last_search_results" path="SearchMsvItem.do?action=lastPage"> </forward> <forward name="create_success" path="EditMsvItem.do?action=create"> </forward> </action> Also here's the create methods in SaveItemAction and in EditItemAction: In SaveItemAction: public ActionForward create( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(); MsvItemForm subform = (MsvItemForm) form; MsvItemTO newItem = new MsvItemTO(); if (isCancelled(request)) { request.removeAttribute(mapping.getAttribute()); return (mapping.findForward("item_main_menu")); } try { PropertyUtils.copyProperties(newItem, subform); } catch (Throwable t) { log.error("populate bean error", t); throw new ServletException("populate bean error", t); } try { MsvItemOperHome msvItemOperHome = (MsvItemOperHome)ServiceLocator.getInstance().getRemoteHome("ejb/mashov/ MsvItemOperHome",MsvItemOperHome.class); MsvItemOper msvItemOper = msvItemOperHome.create(); msvItemOper.createNewItem(newItem); } catch (Exception e) { log.error("insert error", e); throw new ServletException("create item failed", e); } request.setAttribute("ErrorMessageKey","error.update.record.nochange"); request.removeAttribute(mapping.getAttribute()); session.removeAttribute(mapping.getAttribute()); //did not help form.reset(mapping, request); //Duram - did not help return (mapping.findForward("create_success")); } In EditItemAction: public ActionForward create( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { MsvItemForm subform = (MsvItemForm) form; //subform.reset(mapping, request); //needs checking subform.setAction("create"); return (mapping.findForward("success")); } I really really need help with this one Thanks Rivka ************************************************************************************************** The contents of this email and any attachments are confidential. They are intended for the named recipient(s) only. If you have received this email in error please notify the system manager or the sender immediately and do not disclose the contents to anyone or make copies. ** eSafe scanned this email for viruses, vandals and malicious content. ** **************************************************************************************************