struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Yu <j...@scioworks.com>
Subject Re: Redirect and ActionErrors don't play together--is there another way?
Date Thu, 29 Aug 2002 04:21:54 GMT
Hi Dennis,

saveErrors() stores the ActionErrors in the request. Since doing a 
'redirect' creates a new request, you will lose the errors.

What you can do is:

1. in create.do, put the ActionErrors into the session and then redirect to 
table.do
2. in table.do, remove the ActionErrors from the session and use it to call 
saveErrors()
3. forward to the jsp.

Besides, while the following post doesn't address directly your issue, it 
is relevant:

   http://nagoya.apache.org/eyebrowse/ReadMsg?listName=struts-user@jakarta.apache.org&msgId=448820


At 11:12 pm 28-08-2002, you wrote:
>Here's my situation: I have a screen that contains a table of objects
>(say the screen is displayed by "table.do"). There is a link on the
>screen that causes a new object to be created by a Struts action (call
>it "create.do?key=NN"). The action forwards back to "table.do". If the
>creation was successful, the table should now show the list of objects
>with the newly-created one added. If the creation failed, the table
>should display along with an error message.
>
>Here's my problem: when the "Create" link is clinked, the Action that
>does the work needs to do a redirect forward to "table.do". Otherwise
>you end up with "create.do?key=NN" in the browser location bar, and if
>the user then does a refresh on the table screen, instead of refreshing
>table.do the browser attempts to refresh create.do, which is wrong. The
>redirect solves this problem, except for error cases. If creation fails,
>I want to display an error message on the table screen. But all
>ActionErrors associated with the request are lost when I redirect.
>
>Any workarounds?

-- 
John Yu                       Scioworks Technologies
e: john@scioworks.com         w: +(65) 873 5989
w: http://www.scioworks.com   m: +(65) 9782 9610

Scioworks Camino - "Don't develop Struts Apps without it!"


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message