This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts ActionForm does not reset, previous ActionForm data displayed
 
Similar Threads
Deploying struts1.29 appl to struts 1.3.10
HTTP Status 404
Cannot find bean in any scope
newbie problem - populating Action form
problem in tiles application