. The main difference between them is, In servlets both the
presentation and business logic are place it together.
Where as in jsp both are saparated by defining by java
In jsp's the overall code is modulated so the developer
who deesn't know about java can write jsp pages by simply
knowing the additional tages and class names.
One more important to be considered is servlet take less
time to compile. Jsp is a tool to simplify the process and
make the process automate.
Both are webapplications used to produce web content that
mean dynamic web pages. Bot are used to take the requests
and service the clients.
the main difference between servlet and jsp is Jsp only
support to HTTP protocol but servlet can support to
HTTP,FTP, and SMTP protocol
1. The one major advantage of Jsp is we can java code
directly embeded into html code but in servlet is not
2. The second diff. is jsp page automatic compile but
servlet will manually redeploy.
in jsp implicit objects are presents which is we can
implement directly into jsp pages but in servlet implicit
objects are not presents.
JSP is the extension of HttpServlet instance. JSP is
basically used for presentation and servlet is used for
bussiness logic although you use servlet for presentation
after all JSP page also boil down to jsp servlet but
presentation with servlet is realy labours and boring.
Servlet are free from Http protocol you can use
GenericServlet class as base class of your custom servlet
class to perform communication with client either in http
protocal and others but with JSP page your are married only
to HTTP protocol. JSP page provides you with set of implicit
objects that are page, request, response, session,
pageContext, config, out, application, exception (only for
error page) whereas you do not find them in servlet at your
disposal. With help of servlet you can not only use jstl
tags but also design your own custom tags which can be
classic tags, simple tag and tag file. this help you to keep
away java code from JSP page presentaion. tags are like
function call where rest of bussiness logic kept away from
main flow program this helps to keep thing unclutterd and
encouraged reusablity. use of bean with standard action and
tags are easier than the use of bean in servlet.
EL expression, EL function, tags are some new concepts
that can not be used in servlet as it is but need some hard-
coding in java lang to achieve the same.
servlets and jsp both are webapplications to produce the
content means dynamic webpages .both takes the request
parameters to serve the clients
2)application logic and presentation logic are tightly
coupled .application logic cannot support to give the
3)servlets are faster compare to the jsp because jsp files
can be converted to the servlet ie its a time taking process
4) in jsp java code directly embeded into the html code
5) in servlets deployment process is needed i.e web.xml
in jsp no need to write the web.xml file it is
automatically converted to the jsp to servlets
6) in jsp contains the ExpressionLanguage if in our
application development use EL to reduce the application
Java Server Pages (JSP) is a technology that lets you mix
regular, static HTML with dynamically-generated HTML.
Servlets, make you generate the entire page via your
program, even though most of it is always the same. JSP lets
you create the two parts separately. Java Server Pages (JSP)
is a Sun Microsystems specification for combining Java with
HTML to provide dynamic content for Web pages. When you
create dynamic content, JSPs are more convenient to write
than HTTP servlets because they allow you to embed Java code
directly into your HTML pages, in contrast with HTTP
servlets, in which you embed HTML inside Java code. JSP is
part of the Java 2 Enterprise Edition (J2EE).
in servlets presentation logic and applilcation logic are
tightly coupled .application logic cannot support to give
the persentation logic
in spring terminology this problem is called as the
in jsp application logic and persentation logic are
sperated by defineing by java beans
servlets are java classes jsp is not
consist of an html file
for static content &java file contains java code
for dynamic content embeded directly to
in an html page by
using special tags.
Java Servlet is a Java File and is converted into .class
file. If there is any changes in Servlet we must compile
JSP is a HTML file and java coding is embedded into it. The
JSP page is automatically compiled. There is NO deplyment
descriptor file in JSP as web.xml
Servlet is fully java coding and JSP is a collection of
How ThreadSafe page attribute will be working in Servlet as
well as in JSP?Automatically ThresdSafe is true in JSP so
service method will be destroy in each and every request or
not?so how thresd will handle srevice method?