Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to create a central error page

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,

I'm trying to use a central error page where I can diplay errors that arise when a user's account has been locked or similar (it is displayed directly from the login page using an ActionForward).
The page is also the result of a logoff action that is passed before the errors shall be displayed.

The workflow is like this:

Login-Page -> misbehaviour by user -> creating according message -> logoff action -> Logoff-Page displaying the message

My current solution uses a JSP that is being forwarded to from different actions.
The error messages are placed using ActionError objects that are displayed on that particular page (ATM only once a time).

The problem is that I have not to use for these kind of forwards since this will remove previous action errors from the request whereas the request object itself stays the same!

How could a solution looks like that uses one error page for outputting these messages and also using the redirect directive?

Trying to use a form property does not really help since the messages are generated by one action and displayed by another one. Hence the resetting of this property cannot be done within the reseet-methode but has to be done by hand every time you use this property! That is not very comfortable!

Many thanks in advance

Best Regards
 
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you have an action where there is an error. In that action you are getting the ActionForward to your logoff action. When you get that ActionForward, append "?errorCode=" + errNum to the forward that you return. In your logoff action, read the errorCode request parameter (or use a form to get the errorCode), and pull the message associated with that errorCode, add it to the actionerror object and it will be displayed on your logoff page.

It seems a bit "hackey" but it is the best solution I can come up with to fit your needs.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Reth,

Please check your private messages for an important message from me. You can do so by clicking on My Pivate Messages in the upper right corner of the page.
 
    Bookmark Topic Watch Topic
  • New Topic