O'Reilly logo

Special Edition Using Java™ 2 Enterprise Edition by Mark Wutka

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The <jsp:useBean> Tag

When you want to use a Java bean within a Java Server Page, use the <jsp:useBean> tag to either create a new instance of the bean or use an existing bean. The idea behind the <jsp:useBean> tag and its associated helper tags is that you should try to move as much of your application logic as possible out of your JSP so all that remains is code to display the output.

When you encapsulate business objects or business logic into a Java class, you should make that Java class a bean. Many of Sun's Java APIs and tools revolve around the idea that you put your logic into beans and then use tools to help you create applications that use those beans. JSP is one of those tools.

Adding the Bean to the Page

When you add a bean to a JSP, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required