I would shy away from chaining actions.
When the user submits a request to add a new item, the action that handles this
request should
(a) call the necessary business layer methods that in turn update
the database
(b) load object(s) needed by the next view (JSP) in the request or
session
(c) forward to the JSP
Sri
-----Original Message-----
From: White, Joshua A (CASD, IT) [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 19, 2003 8:00 AM
To: Struts Users Mailing List
Subject: Beginner question
I have two struts actions:
"insertIt" - adds an item to the database. When successful, this action
forwards to the "viewIt" action putting the newly inserted items itemId into the
request.
"viewIt" - views an item by itemId (retrieves itemId from request)
When "insertIt" successfully completes, It forwards to "viewIt" without a redirect.
As many of you know, if the user then refreshes the page, the insert action is
performed again.
To solve this problem, I changed the redirect attribute to "true". The refresh
problem disappears. However, the request variable "itemId" gets lost because of the
redirect.
I know this is something every struts developer has worked through. Could someone
suggest a pattern for this type of transaction?
Regards,
Joshua
This communication, including attachments, is for the exclusive use of
addressee and may contain proprietary, confidential or privileged
information. If you are not the intended recipient, any use, copying,
disclosure, dissemination or distribution is strictly prohibited. If
you are not the intended recipient, please notify the sender
immediately by return email and delete this communication and destroy all copies.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]