Hi Ahmad,
One of the simplest and best approach is to follow MVC
pattern in web application.
M-Model
V-View
C-Controller
Model consists of list of java classes, you can give all your business logic in this part.Avoid implementing business logic in jsp itself.
View is collection of jsp pages. Use this only for presentation logic of the web application.(UI design)
Controller is set of servlets that controls the http requests and responses.
There are many frameworks available to develop web application in MVC pattern. Ex.
Struts, Spring.You can use them also.
In simple, use jsp for UI design, use Java classes or java beans for business logic ( put all your scriptlet logic here ) and use servlet to control http request and response ( to decide whice business logic t o be used for which http request, and which jsp page to be displayed as a response to that request)..
So one line answer for your question is
use MVC pattern...