What is the difference between JSP and Servlet?
Answer Posted / 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 |
Post New Answer View All Answers
Explain JSP directives.
How do I use sendredirect?
What is the default value of session attribute in jsp?
Explain scriptlet, expression and declaration in jsp.
What are advantages of jsp over asp, php, pure servlets and others?
Mention the implicit objects in a jsp.
What is the difference between include and jsp directive: include action?
Why do we use expression language in jsp?
How do I create a dynamic web project?
Explain some jsp life-cycle methods that can be overridden.
What are the advantages of jstl?
What is the need for jsp?
Hi, I've applied for HPCL(Information System Officer)& UIIC (A).Plz send me previous/sample papers and any suggestions regarding this exam.Please advice me good study material or related links. Thanks in advance shyam shyamprasad71@gmail.com
Which tag is used to execute java source code in jsp?
Can a subsequent request be accessed with one’s servlet code, if a request attribute is already sent in his jsp?