Iam answering your question about differences between JSP and servlet. When
Internet was invented, they were less number of people using that and so the
websites were not that advanced, to take care of every sort of customers, and so
are the Languages or API that are used to develop Web Applications. They were
mainly just HTML pages that are used then for building webpages. And later on
the usage of internet increased and so the demand for quality websites. So a
website must react to what user want and give that concerned webpage. And so was
developed Servlet. A servlet is basically a Server application that runs on
server and serves the webpage, that a customer requires even in modified form if
required.A servlet just sends a HTML page that is created dynamically. But here
is again a problem is there, the webpages are dynamically created, but does not
solve all the problems. So the need was to create some API that could be used to
build Webpages as if they are Applications, so
came the JSP. In this you can use Java code to build webpage as if it is a
normal application. Both have there own advantages and disadvantages. It is not
that a particular thing can't be done is anyone method, but JSP is easy to use.