Reputation: 8416
It seems that when my JSP encounters an error like a misspelled variable name (for instance), the output of the page just stops.
I have a controller that extends BaseController
with functions that use @RequestMapping()
annotations. I can catch exceptions in these but once any of my functions return
I'm not exactly sure how this is handled.
Just looking for some insight into how this process works. I'm relatively new to Spring.
Upvotes: 2
Views: 4415
Reputation: 20061
The JSP is the view - it exists to render your ouput. It shouldn't handle your programming errors, you need to fix thos beforehand. Likewise it shouldn't handle exceptions arising from problems with the business logic - those should be caught and the appropriate view displayed (e.g. an error page).
See this question for a little more on that:
How to Properly Handle Exceptions in a JSP/Servlet App?
If you still really want Spring to handle the exception in a JSP, see this question:
How to configure spring HandlerExceptionResolver to handle NullPointerException thrown in jsp?
Upvotes: 3