struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sri Sankaran" <>
Subject RE: Beginner question
Date Wed, 19 Mar 2003 15:54:47 GMT
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
(c) forward to the JSP

-----Original Message-----
From: White, Joshua A (CASD, IT) [] 
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?  



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:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message