O'Reilly logo

Struts Kick Start by Kevin Bedell, James Turner

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

Hiding Business Logic Using Beans

One of the first good principles of software design using JSP (and a core principle of Struts) is that you should keep business logic off the JSP page itself at all costs. This is for several reasons:

  • It limits reuse of the business logic.

  • It clutters up the JSP source code.

  • It exposes critical code to potential abuse or neglect by HTML and design staff.

It helps to think of the JSP page as the presentation layer of the application. It is responsible for the user interface but should leave the actual computation and other business-related actions for a lower level.

The way that JSP allows this is through the use of beans. Beans are simply Java classes that follow a few basic conventions. These are

  • Each attribute ...

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