Wrappin' It Up1:18 with Chris Ramacciotti
You've come a long way since we began this course. In this video, I'll recap what we've discussed and give you ideas for further practice & investigation.
Implementing the Favorites Page
At this point, creating a page to display all GIFs marked as favorites is well within your reach. Consider adding a method to
GifRepository that would allow a controller to fetch all favorites.
Then, you need to add a controller method that intercepts the URI of your choice (e.g. /favorites), grab the list of
Gif objects from your new repository method, and add it to the
Finally, return the name of a view that iterates over your list of
Gifs, and you're rockin' and rollin'!
Implementing the Search Page
Creating a page for displaying search results involves the same steps as above. First, you must have a method in
GifRepository that can return all
Gif objects whose
name field contains a specified String. (don't forget to account for case-sensitivity here).
Then, you must have a controller method that intercepts the URI specified by the search form's action attribute. This method must have a parameter annotated with
@RequestParam that is named the same as the name attribute of the text input in the search form. This is similar to our use of
@PathVariable, except that the search term will appear in the URI's query string, for example /search?q=compiler. In this method, you'll also call the repository method you created for searching a
Finally, in a similar fashion as you did with the Favorites page, return the name of a Thymeleaf view you've coded to iterate over the list of
Gif objects in the
And there you have it, 0:00 a fully functioning web application using the Spring framework. 0:01 You've seen a lot since the beginning of this course. 0:05 We've used Gradle to manage our dependencies on third-party libraries and 0:07 we've seen how various components of the Spring framework interact. 0:12 From the configuration class through the dispatcher's servlet, to controllers. 0:15 Finally we discussed how the model view controller design pattern 0:20 helps us organize the data, presentation and 0:24 request handling layers of our application. 0:27 There are many places to go from here. 0:30 In the teachers notes I've made some suggestions on a couple of features that I 0:33 think you're ready to tackle right now, including a page for 0:36 displaying all favorites, as well as a page for displaying search results. 0:40 Beyond those features, there are several other features that 0:44 any production web application should consider, 0:47 such as incorporating a database, applying security to all parts of your app, and 0:50 using unit testing to verify the intended functionality of your app. 0:55 It turns out that Spring offers some handy tools for each one of these. 0:59 I hope you've enjoyed your time coding with me in Spring. 1:04 And most importantly, 1:07 I hope you've found some things that are helpful in your own software endeavors. 1:08 Keep at it, and be sure to share any apps and features you build in the forum. 1:12 Until next time. 1:17
You need to sign up for Treehouse in order to download course files.Sign up