Join Shonna Smith for an in-depth discussion in this video Model methods, part of Spring: Spring MVC (2018).
- [Instructor] Now we can talk about some…of the more interesting ways that you can…manipulate your model as a part…of the request handling workflow.…Spring MVC allows you to create what's called model methods.…These are methods that are called on your controller…so that you can add model attributes…before any request handler method is called.…A controller can have any number of model methods,…and it can have flexible method signatures…just like your request handler mappings.…Plus, Spring MVC makes sure that your model methods…are always called before any of your…request handling methods.…
Let's take a look at an example.…So for this example, I'm going to add a model method…to our quote request management controller,…which I have open already.…So given that the purpose of model methods…is to help you add attributes to your model,…on a common or a global level, as far as the controller…is concerned, I'm going to add a method…and give it a hopefully self-explanatory name,…call it addCommonAttributes.…
Now, I want to use a model method…
- Using Spring MVC for web projects
- Spring MVC controllers
- Creating controllers and views
- Spring MVC models
- Creating the model
- Request mapping
- Spring MVC views
- Custom app configuration
Skill Level Intermediate
1. Using Spring MVC for Web Projects
2. Spring MVC Controllers
3. Spring MVC Models
4. Spring MVC Views
5. Custom App Configuration
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.