Chapter 8. Sharing Data Between JSP Pages, Requests, and Users
So far we’ve covered the JSP basics: how to generate dynamic content and capture user input using JSP standard action elements for working with beans, how to do conditional processing and embed Java code in pages using JSP scripting elements, and how to locate and fix different types of errors in a JSP page. With that out of the way, we can turn our attention to the JSP features and techniques needed to develop real applications.
Any real application consists of more than a single page, and multiple pages often need access to the same information and server-side resources. When multiple pages are used to process the same request, for instance one page that retrieves the data the user asked for and another that displays it, there must be a way to pass data from one page to another. In an application in which the user is asked to provide information in multiple steps, such as an online shopping application, there must be a way to collect the information received with each request and get access to the complete set when the user is ready. Other information and resources need to be shared among multiple pages, requests, and all users. Examples are information about currently logged-in users, database connection pool objects, and cache objects to avoid frequent database lookups.
In this chapter you will learn how scopes in JSP provide access to this type of shared data. You will also see how using multiple pages to process ...
Get Java Server Pages now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.