Summary

In this chapter, we discussed file upload and error handling. Uploading a file is not really complicated. However, a big design decision is what to do with the uploaded files. We could have stored the images it in a database, but instead we chose to write it to the disk and save the location of each user's picture in their session.

We saw typical ways to handle exceptions at the controller level and at the servlet container level. For additional resources on Spring MVC error handling, you can refer to the blog post at https://spring.io/blog/2013/11/01/exception-handling-in-spring-mvc.

Our application is looking pretty good already and yet the amount of code we had to write is very reasonable.

Stay tuned for the next chapter where we will ...

Get Spring MVC: Designing Real-World Web Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.