A More Robust JSP Example
The first example was limited, as it only ran on a single page. Let's expand the example a bit and make the code slightly more robust. To do so, we will add the following features to our example:
Instead of using an array to store the data, we will build a special Java class to store it.
We will store banner information in the application object, so any page can access the same data.
We will build an include file that any page can use to display the banner.
Once all of these features are created, we will combine and use them in a separate page to show how it all comes together. Let's start off by building a JavaBean that is a class with the sole purpose of storing banner ad data, as shown in Listing B.2. Save this example ...
Get JSP™ and XML Integrating XML and Web Services in Your JSP™ Application 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.