What is the difference between JSP and Servlet?

Answers were Sorted based on User's Feedback



What is the difference between JSP and Servlet?..

Answer / pratheeka reddy

Servlets are pure java programs.here we can't use HTML.
But in JSP we use HTML,so we can use and modify the data
very easily.
Servlets are faster than JSP.bcoz while running JSP
programs it will be converted into Servlets and then
executed,so it takes more time.

Is This Answer Correct ?    205 Yes 74 No

What is the difference between JSP and Servlet?..

Answer / satyabrata

Both servlet and jsp are web components. But servlet is
best suited for request processing, handling the business
logic while jsp is suitable for content generating .Its
easy to include html tag in jsp rather than servlet.Also
jsp is compiled to servlet when first loaded to
webserver.So in many framework servlet act as a controller
while jsp as a view.Also implicit object and action
elements available in jsp but not in servlet.

Is This Answer Correct ?    103 Yes 15 No

What is the difference between JSP and Servlet?..

Answer / ranjan satapathy

Jsp is better for preparing presentation pages, while
servlet is good for request processing as it's more
difficult to write include, forward a static or dynamic url
with in out.println() ,

Jsp has also all implicit objects, we need not have to
instantiate any which is easier.

error handelling is easy in jsp isErrorPage="true"
errorPage="/page"

we need not have to bother about init(),service(),destroy
(),doGet(),doPost()in jsp.

in servlet for each time changing we have to explicitly
compile it.

Jsp automatically compiled by container when we reload the
page.

Is This Answer Correct ?    77 Yes 11 No

What is the difference between JSP and Servlet?..

Answer / xxxxxx

1-The most important difference is that whenever we do some
changes in a servlet we need to build the application
completely but no need to do the same in case of jsp....

Is This Answer Correct ?    73 Yes 9 No

What is the difference between JSP and Servlet?..

Answer / sss

JSP is mainly used for presentation only. A JSP can only be
HttpServlet that means the only supported protocol in JSP
is HTTP. But a servlet can support any protocol like HTTP,
FTP, SMTP etc.

Is This Answer Correct ?    22 Yes 4 No

What is the difference between JSP and Servlet?..

Answer / ravi sekhar

Like we all know both jsp's and servlets are used in web
applications.The only difference is we have html embedded in
java code in case of servlets making use of implicit
response objects and in case of jsp's it is java code that
is embedded in html code i.e.,what we call business logic
using scriplets(<%,%>).We have different applications for
both jsp's and servlets when we talk about flexibility we
opt for jsp's.It is because in case of servlets both
business logic and presentation logic are given by the same
java file ,so any change in presentation logic wll lead to
the entire compilation of the java file and replacing the
.class file back in the servlet container.When it comes to
jsp's we have both application and presentation logic
seperated.So even if u modify the presentation logic we need
not compile or modify any content of servlet engine.We are
aware of the modern web technologies advancements every day
and more over in the competing market environment it is
necessary to modify the look and feel of the page constantly
.So we prefer jsp's rather than servlets most of the
times.I do agree that servlets finds its application in
many cases but still jsp's can do the job for us.

Is This Answer Correct ?    18 Yes 2 No

What is the difference between JSP and Servlet?..

Answer / y ramakrishna

A servlet and jsp's both are equal ,there could many
differences in that mainly one difference is a jsp's code
will internally convert to an servlet internally.

Also the person who use jsp's no need to know java
completely.

Is This Answer Correct ?    30 Yes 15 No

What is the difference between JSP and Servlet?..

Answer / gaurav

The main difference between jsp and servlet is that in
servlet we write html code in java class and in jsp we write
java code in html page.Servlet is a java class.According to
MVC(model,view,controller) pattern servlet is used as
controller while JSP is used as view.

Is This Answer Correct ?    7 Yes 1 No

What is the difference between JSP and Servlet?..

Answer / swetha bammidi

both servlet and JSP are same.Both are using to represent a
dynamic content to the user but their job is different.And
servlets are used for business logic whereas JSP are used for
presentation logic.If u want to present the data to the user once using servlets what you do is you put HTML with in java.if you want to present the data to the user once using JSP what you do is you put java with in HTML

Is This Answer Correct ?    5 Yes 1 No

What is the difference between JSP and Servlet?..

Answer / amit kharkia

1)jsp is the tag oriented where as servlet are not the tag
oriented.
2)for the servlet mpping is required where as for jsp no
mapping is required.
3)jsp files are saved by .jsp extension where as servlet
files are saved by .java extension.
4)servlets are more faster than jsp.

Is This Answer Correct ?    6 Yes 2 No

Post New Answer

More JSP Interview Questions

How to ignore the el expression evaluation in a jsp?

0 Answers  


How do I save a jsp file?

0 Answers  


What do you mean by jsp?

0 Answers  


Explain the uses of <jsp:usebean> tag.

0 Answers  


Which package does jsp api consist of?

0 Answers  






What are the different types of jsp tags?

0 Answers  


How can we retrieve warnings?

0 Answers  


Why should we not configure jsp standard tags in web.xml?

0 Answers  


sample program for reading mails from inbox with file attacchments in servlet

0 Answers  


What is the requirement of a tag library?

0 Answers  


What is the difference between server side and client side programming?

0 Answers  


What is the difference between directive include and jsp include?

0 Answers  


Categories