• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Error Handling across multiple Actions

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am storing ActionError objects (under the Globals.ERROR_KEY) in Action1 and then forwarding to Action2 for processing, but I'm then getting an JspException saying the 'error' bean cannot be found in any scope. When Action2 runs, are the error objects in the original request overwritten or erased?

Can someone help me out in diagnosing the issue. This is using Struts 1.1

In my jsp, I'm accessing the collection as follows:



Thanks for any help,
Daniel
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Daniel McDade:
When Action2 runs, are the error objects in the original request overwritten or erased?


Yes, they are. Struts cleans them out for each new action. That's one of the disadvantages of "action chaining". You will have to come up with some other way of passing messages from one action to another, such as storing them under a different key in the request and then having the second action retrieve them under that key and rewriting them using the saveErrors method.
 
Daniel McDade
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Merrill Higginson:

Yes, they are. Struts cleans them out for each new action. That's one of the disadvantages of "action chaining". You will have to come up with some other way of passing messages from one action to another, such as storing them under a different key in the request and then having the second action retrieve them under that key and rewriting them using the saveErrors method.



Would the code to retreive those stored ActionError objects look something like this?

 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, that looks good.
 
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic