I want to know exact difference between servlets and jsp?.
Does it improves the performance when database connection code inclides in jsp page?
Which one is better choice.Including the Database connection using the Servlet or jsp.
A jsp is compiled into a servlet and then executed, so there's no technical difference.
But in practical terms, a jsp exists to generate a web page. A servlet does work on the server, but will usually pass control to a jsp to display something to the user.
As far as the database code goes, I personally like to keep it out of the jsps. In a three tier model, the jsps are the presentation layer and the servlets are the middle or business layer (with the database itself as the final layer). I put the database code in the middle layer, in the servlets.
While I would agree that servlets can be used to accomplish this, but a more robust architecture might be to utilize RMI, CORBA, or EJBs as the middle layer.
-gc "I don't look busy because I did it right the first time."
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.