Servlets are used to develop dynamic webcontent ie WebApplications
Servlets are normal java classes Who generally have to extend javax.servlet.http.HttpServlet class.
These are precompiled classes. (This is nothing but a Servlet Template) Instead in a JSP java code is embedded in HTML for easier Page generation as HTML code generation in Servlets could be very tedious if the HTML data is large. At Runtime the JSP/Servlet container converts the JSP into a Servlet and executes it.