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 ...