You should ensure your mapping scope is indeed 'request' e.g.
//Test for presence of attribute in Map
if (mapping.getAttribute() != null)
{
//Test that mapping is indeed scoped as request
if ("request".equals(mapping.getScope()))
{ //remove the attribute from the request
request.removeAttribute(mapping.getAttribute());
}
else
{ //acquire session
HttpSession session = request.getSession();
//remove the attribute from your request
session.removeAttribute(mapping.getAttribute());
}
}

I did not see the code for your edit function so I cannot comment on that
HTH,
Martin-

----- Original Message ----- From: "Rivka Shisman" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Tuesday, June 21, 2005 9:28 AM
Subject: problem with removing form bean


Hi all



I have a very annoying problem with 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 the 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 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.

In SaveItemAction i do :


request.setAttribute("MessageKey","update.record.success");

                       request.removeAttribute(mapping.getAttribute());

                       return (mapping.findForward("create_success"));



I know that the request that arrives to EditItemAction is the one I sent
from SaveItemAction because the attribute "MessageKey" arrives properly.

But for some reason, the ItemForm bean is not removed as I requested.



The scope in the struts-config is request and I also checked by printing
mapping.getScope() which was also request.





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. **
**************************************************************************************************
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to