Results 1 to 3 of 3

Thread: Spring MVC: Exception handler sending user back to page that generated the submit.

  1. #1

    Lightbulb Spring MVC: Exception handler sending user back to page that generated the submit.

    Here is my scenario:
    1. User opens the form page,
    2. User fills up the form and press the submit button,
    3. If the form data is OK the success page is showed,
    4. If something is NOT OK, throws a business exception and user gets the form page with a message explaining the error.



    Does spring web MVC has something that could help me doing that ?
    I could not find anything that helped.
    Do you guys know any trick that could help to code that easily?
    I have some ideas like putting on the form pages a hidden field with a tag that stores the page url that is making the form, than in exception handler resolver I could get this value from the request object and redirect the user to the page that generated the submit. But it does not “look good” to me.
    Any other ideas?

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

    Default

    What you describe here is validation and validation is perfectly handled by spring, instead of hacking around with exception resolvers simply implement a validator (or use JSR-303 for validation) and have spring handle that for you. I suggest a read of the validation chapter/section in the reference guide.
    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

    Default

    It helped, thanks man.

Posting Permissions

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