GeeCON Prague 2014*
The moose likes Other Application Frameworks and the fly likes Handling business logic exceptions with Spring MVC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Handling business logic exceptions with Spring MVC" Watch "Handling business logic exceptions with Spring MVC" New topic
Author

Handling business logic exceptions with Spring MVC

joe black
Ranch Hand

Joined: Dec 03, 2003
Posts: 103
I have a registerService which throws a RegistrationException if a username or email is already taken. On my registration page, I would like the user to see the message contained within the exception, instead of forwarding them to an error page ( I have seen examples of this ). I am using Spring MVC with a SimpleFormController.
[ November 11, 2006: Message edited by: joe black ]
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

Joe,

See the Exception Handling in Spring MVC - Handling Exceptions

You can use a SimpleMappingExceptionResolver. Something like -


[ November 13, 2006: Message edited by: Sonny Gill ]

The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
joe black
Ranch Hand

Joined: Dec 03, 2003
Posts: 103
That would take the user to a different page. I would like a post back to the same form the user came from, with the error message at the top of the page - basically the same behavior as the Validator.
 
GeeCON Prague 2014
 
subject: Handling business logic exceptions with Spring MVC