Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
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,
a fully functioning web application using the Spring framework.
You've seen a lot since the beginning of this course.
We've used Gradle to manage our dependencies on third-party libraries and
we've seen how various components of the Spring framework interact.
From the configuration class through the dispatcher's servlet, to controllers.
Finally we discussed how the model view controller design pattern
helps us organize the data, presentation and
request handling layers of our application.
There are many places to go from here.
In the teachers notes I've made some suggestions on a couple of features that I
think you're ready to tackle right now, including a page for
displaying all favorites, as well as a page for displaying search results.
Beyond those features, there are several other features that
any production web application should consider,
such as incorporating a database, applying security to all parts of your app, and
using unit testing to verify the intended functionality of your app.
It turns out that Spring offers some handy tools for each one of these.
I hope you've enjoyed your time coding with me in Spring.
And most importantly,
I hope you've found some things that are helpful in your own software endeavors.
Keep at it, and be sure to share any apps and features you build in the forum.
Until next time.
You need to sign up for Treehouse in order to download course files.Sign up