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.
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.