Difference Between Servlet and JSP

SHARE & COMMENT :

In this article we will list some of the differences between Servlet and JSP

ServletJSP
A servlet is a server-side programJSP is an interface on top of Servlets
Executes inside a Web server, such as TomcatA JSP program is compiled into a Java servlet before execution
Receives HTTP requests from users and provides HTTP responsesEasier to write than servlets  as it is similar to HTML.
Written in Java, with a few additional APIs specific to this kind of processingCan make use of Javabeans also
In MVC architecture Servlet acts as controller.In MVC architecture JSP acts as view.
Servlet advantages include:

    • Performance-get loaded upon first request and remains in memory idenfinately.
    • Simplicity- Run inside controlled server environment. No specific client software is needed:web broser is enough
    • Session Management-overcomes HTTP’s stateless nature

<li>Java Technology-network access,Database connectivity, j2ee integration

JSP Provides an extensive infrastructure for:

  • Tracking sessions.
  • Managing cookies.
  • Reading and sending HTML headers.
  • Parsing and decoding HTML form data.
  • JSP is Efficient: Every request for a JSP is handled by a simple Java thread
  • JSP is Scalable: Easy integration with other backend services
  • Seperation of roles: Developers, Content Authors/Graphic Designers/Web Masters

Previous Tutorial : ServletConfig in Servlet  || Next Tutorial : MVC Architecture Using JSP and Servlet

Comments

comments

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Speak Your Mind

*

Close
Please support the site
By clicking any of these buttons you help our site to get better