Question: why jsp and servlets are used?
Answer: Servlets are mainly used to extend the applications hosted by webs servers, however, they can respond to other types of requests too. For such applications, HTTP-specific servlet classes are defined by Java Servlet technology. A JSP is a text document which contains two types of text: static data and dynamic data.