Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- Building Our Model 7:46
- In Memory DAO implementation 1 question
- Template Reuse and Static Resources 11:04
- Template Reuse 1 question
- Adding to and Iterating a List 13:43
- Redirecting 1 objective
- Using Filters and Request Attributes 8:25
- Using filters 3 questions
- Accessing Specific Items 12:54
- Details 8:34
- URL Parameters 2 questions
- Messaging 6:10
- Build Your Own Flash Messages 14:13
- Review Messaging 3 questions
- Request Handled 1:39
Well done!
You have completed Intro to Java Web Development with Spark!

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
What do you do when your micro-framework doesn't provide a feature you need? You build it!
Flash message CSS
#flash-message{
background-color: #2c89ba;
border-radius: 5px;
color: #fff;
display: block;
font-size: 14px;
padding: 10px 20px;
}
Explore
One way you to get around the duplication is by taking advantage of the request.attributes and creating a model object in a global before filter. That would allow you to do whatever injecting of the model that was common to all requests. In the controller you just then pull out request.attributes[“model”] and add specific information, but it would have the flash message.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Sergey Selyuto
5,623 Points0 Answers
-
Murilo de Melo
14,456 Points0 Answers
-
Ricardo Sala
16,212 Points1 Answer
-
Ben Foster
9,958 Points1 Answer
-
Jonny Patterson
7,099 Points1 Answer
-
Vítor Avelino Dutra Magalhães
44 Points5 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up