Implementing page redirection and Flash-scoped beans
Creating lots of session-scoped beans causes some performance and security issues and is not always recommended in small-scale and simple applications. Most often than not, using request-scoped objects is still the best way to manage data among request transactions. But as shown in the previous recipe, it would be a lot easier to share data if session-scoped beans are used, especially when there are several redirections. Another solution to avoid sessions sharing data among request handlers will be illustrated by this recipe.
Getting started
Open again ch03
for some additional features of @Controller
when it comes to page redirection. This recipe will focus on other methods of redirection than the usual HTML <form>
submission and <a>
hyperlink page jump.
How to do it...
To implement page redirection with Flash-scoped objects, apply these steps:
- To start our experiment on implementing page redirection, let us create a controller...