Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Well done!
You have completed Intro to Java Web Development with Spark!
You have completed Intro to Java Web Development with Spark!
Preview
Let’s explore how to handle exceptions with grace and ease. You will write your own Flash messaging tool which you will use to inform your users one time over redirects.
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 upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
And of course, because the only
state that exists is what we've made
0:00
appear to be stateful, we're gonna need
to jump through some hoops to get there.
0:00
A common approach to solve the problem
of keeping the user informed about their
0:04
actions is to use what is
known as a flash message.
0:08
You've seen them, they're usually
displayed in a box on a page.
0:12
It says something like this,
see the message here that says,
0:14
all right your details were updated.
0:17
Now most fully featured frameworks
provide this nice to have feature, but
0:19
some micro-frameworks, ours in
particular, don't quite have those yet.
0:23
But that doesn't mean
we can't craft our own.
0:27
The really nice thing that our
micro-framework provides is the handling
0:29
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