Saumyaraj Zala wrote:So according to you should i separate my code in from jsp in the form of servlet?
Not everything should be in Servlets. Accessing your database directly from a Servlet is again not a good practice - you will soon be banging your head over reusability constraints when you do that. Better way is using separate set of reusable classes where your database access logic resides. Use servlets only for controlling and delegating requests between views and models. Read
this article to know more about the whole shebang behind the scene of MVC
pattern in a Servlet environment.