Using Java Beans with JSPs

The JSP specification enables you to include JavaBeans, which are different from the Enterprise JavaBeans discussed later in this book. JavaBeans encapsulate presentation logic or rudimentary business logic in your pages. By encapsulating logic in a JavaBean, you can keep your Web developers from accidentally compromising or corrupting your Java code. JavaBeans help you create more maintainable pages.

Integration of JavaBeans with JSP pages is done through the use of three JSP actions. Let's take a look at each of these tags and how to use them.

JSP Tags for Using Beans

The <jsp:useBean> tag enables a JSP developer to specify a JavaBean to be included in the JSP page. This tag tries to instantiate a JavaBean, and gets ...

Get J2EE™ Applications and BEA™ WebLogic Server™ now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.