What is the differance between Jsp and servlets ?

@varun121 (104)
India
February 5, 2007 8:25am CST
I want to know the differance between Jsp and servlets .I heard that Jsp will become servlets after its loaded How it is ?Can any one tell
3 responses
@sumit057 (227)
• India
3 Jul 10
jsp is a java server page. java coding .JSP technology enables rapid development of web-based applications that are server- and platform-independent. A servlet is a Java programming language class used to extend the capabilities of servers that host applications accessed via a request-response programming model. Although servlets can respond to any type of request, they are commonly used to extend the applications hosted by Web servers. For such applications, Java Servlet technology defines HTTP-specific servlet classes. The javax.servlet and javax.servlet.http packages provide interfaces and classes for writing servlets. All servlets must implement the Servlet interface, which defines life-cycle methods. When implementing a generic service, you can use or extend the GenericServlet class provided with the Java Servlet API. The HttpServlet class provides methods, such as doGet and doPost, for handling HTTP-specific services. we prefer JSP over servlets for our presentation logic because we knows two important things about both that is (1)HTML embedded in Java called Servlet , and (2)Java embedded in HTML called JSP for presentation logic we just need a simplified coding so we prefer JSP, and for business logic that is more complicated and required security we use Servlets.
@hamith (6)
• India
10 Nov 07
JSP can be Servlets. In JSP we can embed java code with html . Both JSP, and servlets are run on Webcontainer. In JSP also internal servlet which will call init() method once depolyed in webcontainer.
• China
2 Nov 07
Right Jsp will become Servlet Jsp is short for Java Sever Page,which include html code and java code. servlet is short for server Applet. Applet is a small application program which can run in the sever. jsp can't not be runned before became servlet. do you know the class HttpServlet? Jsp is expanted from HttpServlet. so Jsp is included in Servlet,but it is code form, which should be compile to application program form before running.