JSPs should contain only presentation logic

If an MVC framework is being followed, then most of the content of a JSP should simply present and format the data (the "Model" objects of the MVC framework) being passed to the JSP by the Controller (or its delegate).

Many feel that when using MVC, code in a JSP which performs a task not directly related to presentation (such as business logic, validation, error handling, etc.) probably belongs elsewhere. For example, the most natural home for validation code is the Model Object.

This is a specific example of a general guideline of lasting value - the idea of separating the "layers" of the application : the user interface, the business logic or model, and the database. The underlying reason for this separation is, ultimately, to allow people with different skills to make significant and effective contributions to the development of an application. User interface designers should be concerned almost entirely with presentation issues, while a database expert should be concerned almost entirely with writing SQL.

(See as well the package by feature, not layer topic.)

See Also :
Use Model View Controller framework
Package by feature, not layer
Validation belongs in a Model Object