Chapter 15. Developing JavaBeans for JSP
The JavaBeans specification[7] was primarily developed with graphical components in mind. But JavaBeans represents a design pattern for components that also makes sense for faceless components used to structure a server-side application. The JSP specification provides a number of standard actions to support the use of JavaBeans, as described in the previous chapters.
You can use JavaBeans components in a pure JSP application to structure the application and minimize the amount of code needed in the JSP pages. In an application that uses both servlets and JSP pages, beans can be used as a carrier of data between the two domains. By using beans with an eye towards the recommendations in the J2EE application programming model, you can also make it easier to migrate the business logic to Enterprise JavaBeans when warranted by new requirements.
In this chapter, we look at the JavaBeans model and how it applies to the type of faceless JavaBeans you can use in a server-side application, using some of the beans from previous chapters as examples.
JavaBeans as JSP Components
JavaBeans are simply regular Java classes designed according to a set of guidelines. By following these guidelines, development tools can figure out how the bean is intended to be used and how it can be linked to other beans. The JavaBeans specification characterizes beans as classes that:
Support introspection so that a builder tool can analyze how a bean works
Support customization ...
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.