File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Struts ActionForm does not reset, previous ActionForm data displayed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts ActionForm does not reset, previous ActionForm data displayed" Watch "Struts ActionForm does not reset, previous ActionForm data displayed" New topic
Author

Struts ActionForm does not reset, previous ActionForm data displayed

Lisa Lang
Greenhorn

Joined: Oct 13, 2004
Posts: 2
I've been working with Struts for several months now but I'm stumped. I've been able to create Actions that retrieve data (using Torque) and populate an ActionForm before forwarding on to the .jsp for display. However, I am trying to provide a means to add a new object and no matter what I put in my NewAction the data from the previously populated ActionForm re-appears!

struts-config.xml
<action
attribute="WSAForm"
input="/pages/WSA.jsp"
name="WSAForm"
path="/NewWSA"
type="com.qualcomm.sa.struts.action.NewWSAAction"
validate="false"
scope="request">
<forward name="success" path="/pages/WSA.jsp" />
<forward name="error" path="/pages/Error.jsp?from=NewWSA" />
</action>
<action
attribute="WSAForm"
input="/pages/WSA.jsp"
name="WSAForm"
path="/RetrieveWSA"
type="com.qualcomm.sa.struts.action.RetrieveWSAAction"
validate="false">
<forward name="success" path="/pages/WSA.jsp" />
<forward name="error" path="/pages/Error.jsp?from=RetrieveWSA" />
</action>

from NewWSAAction.execute()

log.debug("Entered NewWSAAction.execute()");
WSAForm wsaForm = (WSAForm) form;
wsaForm.reset(mapping, req);
return (mapping.findForward("success"));

// NOTES:
// 1) The log statement does appear
// 2) I've even tried explicitly resetting each attribute as follows:
// wsaForm.setSvc_name( "" );

from WSA.jsp
<TD align="right" class="fieldLabel" colSpan="2">Service Name</TD>
<TD class="fieldEntry">
<html:text property="svc_name" size="50" maxlength="50" />
</TD>

Even if I restart the app it re-displays the data from the last populated wsaForm! I've got scope set to "request" in struts-config and I'm calling wsaForm.reset() in my Action yet it appears to be getting this data from somewhere else!

Any ideas?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Struts ActionForm does not reset, previous ActionForm data displayed
 
Similar Threads
Cannot find bean in any scope
newbie problem - populating Action form
HTTP Status 404
problem in tiles application
Deploying struts1.29 appl to struts 1.3.10