We’re improving the Post editing in NixMash Spring v0.4.2 with a “Save and Continue” function, represented by the SAVE button and resulting “Post updated!” Modal. We’re going to talk about how we’re doing that in Json and Spring MVC.
The MVC Method
Our Spring MVC method looks simple but does a lot. We have full validation of our PostDTO object using the @Valid annotation, return “ERROR” if any of the fields fail, like a title is missing or too long.
We could return result error details, but we’ll keep it simple by returning an ERROR string and a special Modal to get the user’s attention.