I want to know what is the difference between JSP and SERVLET. when you say JSP it will automatically converted in to Servlet then why all the developers are mentioning that we should call DAO from servlet only not by JSP.
Is there any particualr reason to use only SERVLET. please let me know if you have an answer.
Yes, tht's true that every JSP is ultimately converted to servlet, but that doesnt mean, you should start writing all your application logic in a JSP.
JSP is designed to be used as views/for generating markup. Its not good practice to put lots of java code into JSP.
See this for difference
Ulf Dittmer wrote: There should be no Java code in JSPs.
That's true, but most of the beginners find it difficult to have complete java less JSP.
I personally prefer freemarker, so there's no choice of writing code into template.
Joined: Mar 22, 2005
most of the beginners find it difficult to have complete java less JSP.
Possibly, but it's still much easier to start off using proper techniques than to learn bad practices and try to shed them later. No responsible professional should advocate keeping any amount of Java code in JSPs these days.