what is the difference between Servlet and JSP?Advantage of
JSP over Servelt?Any concept present in JSP which we cant
implement in Servlet?
Answers were Sorted based on User's Feedback
Answer / shailaja
. 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
beans .
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.
Is This Answer Correct ? | 302 Yes | 74 No |
Answer / abilash
servlet: its a java class so for every change we have to
compile the code to reflect the change.Mainly using for
writing business logics.
jsp:its a file, its automatically converted into a servlet
on deploying. We can't compile it explicitly.the changes
will get reflect by saving the file.Its mainly used for
presentation of data
Is This Answer Correct ? | 235 Yes | 41 No |
Answer / ravindra nhavi
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
possible
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.
Is This Answer Correct ? | 124 Yes | 32 No |
Answer / farhaananwar
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.
Is This Answer Correct ? | 92 Yes | 26 No |
Answer / ramaswamy ratnala
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
presentation logic
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
development time
Is This Answer Correct ? | 48 Yes | 16 No |
Answer / nisha
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).
Is This Answer Correct ? | 51 Yes | 27 No |
Answer / ramaswamy ratnala
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
dependency problem
in jsp application logic and persentation logic are
sperated by defineing by java beans
Is This Answer Correct ? | 28 Yes | 19 No |
Answer / chandra
servlet: its a java class so for every change we have to
compile the code to reflect the change.Mainly using for
writing business logics.
jsp:its a file, its automatically converted into a servlet
on deploying. We can't compile it explicitly.the changes
will get reflect by saving the file.Its mainly used for
presentation of data.
Is This Answer Correct ? | 9 Yes | 2 No |
Answer / r b arumugam
Java Servlet is a Java File and is converted into .class
file. If there is any changes in Servlet we must compile
once again.
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
HTML,JSPtag,JSTL
Is This Answer Correct ? | 8 Yes | 3 No |
Answer / aarti
servlet Jsp
1
servlets are java classes jsp is not
2
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.
Is This Answer Correct ? | 67 Yes | 65 No |
What are some advantages of storing session state in cookies?
What is Servlet API used for connecting database?
Can filter be used as request or response?
can i call init() method in destroy() method of servlset. ?
Which method of the httpservletrequest object is used?
Why jsp is better than servlet?
Can you use javascript in servlets?
List out difference between a JavaBean from a Servlet?
What is the difference between sendredirect() and forward() in a servlet?
What is servlet tunnelling?
What do you mean by servlet?
What is use of parseQueryString?