7.1. Using JavaServer Pages with JavaBeans
JavaServer Pages should be seen as part of the presentation layer of our application. If this is so, then where should the business logic reside? There are two popular answers to this: in a servlet, or in an Enterprise JavaBean (EJB). We'll look at the servlet case coming up very shortly, and at the EJB case later in the book.
In either case, we have a common challenge: How do we share data between the JSP and the component handling the logic? Because the HTTP request and response objects are accessible within both JSPs and servlets, you might guess (correctly) that they will be part of the solution. If we have more than just one or two data items that need to be passed, it is logical and desirable that ...
Get J2EE™ and JAX™: Developing Web Applications and Web Services 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.