Results 1 to 3 of 3

Thread: ExceptionResolver: display error in current page

  1. #1
    Join Date
    Dec 2012
    Location
    Belgium
    Posts
    2

    Default ExceptionResolver: display error in current page

    Hi all,

    I wonder if it is possible to write an ExceptionResolver that allows me to set an error message (or any kind of data) on the request and forward the user back to the page he was coming from. All the filled in fields should also be set again.
    I'm using the @MVC model with spring 3.1.x. This should work in a similar way like when you validate a form's input fields using a Spring Validator. In the latter, an Errors or BindingResult is populated with the result of the validation.
    I just don't want to write this boilerplate code in each of my controllers. It should be managed on a central place.

    Regards,
    Davy

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,695

    Default

    No... The ExceptionResolver is to generic for this it isn't aware of the context. It might not even be possible to render a page as the constructing the model might have failed and what would you then render?

    If you want this to be part of your flow then you need to add it to your controller I'm afraid and handle it there.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Dec 2012
    Location
    Belgium
    Posts
    2

    Default

    What we want to achieve is to display an error message in case of a specifc error message. This should be shown on the page where the user is coming from. If all the filled in fields could be preserved, that would have been nice. I wanted to implement this in a generic way so that we wouldn't have to copy this logic in all of the controllers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •