ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
Google
   
 
Categories >> Software >> Java Related >> Java J2EE >> Servlets
 
 


 

 
 Core Java interview questions  Core Java Interview Questions (1728)
 Advanced Java interview questions  Advanced Java Interview Questions (332)
 Swing interview questions  Swing Interview Questions (44)
 EJB interview questions  EJB Interview Questions (134)
 Servlets interview questions  Servlets Interview Questions (255)
 Struts interview questions  Struts Interview Questions (196)
 JDBC interview questions  JDBC Interview Questions (187)
 JMS interview questions  JMS Interview Questions (9)
 SunOne interview questions  SunOne Interview Questions (3)
 J2EE interview questions  J2EE Interview Questions (71)
 Weblogic interview questions  Weblogic Interview Questions (147)
 Websphere interview questions  Websphere Interview Questions (14)
 Java Networking interview questions  Java Networking Interview Questions (20)
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions (87)
Question
what is the difference between Servlet and JSP?Advantage of 
JSP over Servelt?Any concept present in JSP which we cant 
implement in Servlet?
 Question Submitted By :: Servlets
I also faced this Question!!     Answer Posted By  
 
Answer
# 1
. 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 ?    290 Yes 69 No
Shailaja
 
Answer
# 2
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 ?    225 Yes 39 No
Abilash
 
 
 
Answer
# 3
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 ?    115 Yes 30 No
Ravindra Nhavi
 
Answer
# 4
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 ?    88 Yes 24 No
Farhaananwar
 
Answer
# 5
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 ?    44 Yes 15 No
Ramaswamy Ratnala
 
Answer
# 6
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 ?    47 Yes 25 No
Nisha
 
Answer
# 7
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 ?    25 Yes 17 No
Ramaswamy Ratnala
 
Answer
# 8
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 ?    64 Yes 61 No
Aarti
 
Answer
# 9
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 ?    3 Yes 0 No
Chandra
 
Answer
# 10
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 ?    3 Yes 0 No
R B Arumugam
 

 
 
 
Other Servlets Interview Questions
 
  Question Asked @ Answers
 
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? AZTEC 1
What compiler do not do if we create our own constructor? HCL 5
Can threads be used in Servelet?   3
why are extending GenericServlet and why are extending HttpServlet explain?   7
what is servlet life cycle? Inforica 3
difference between sendredirect,forward and url rewritting TCS 5
Is classes folder is compulsory in web-inf/ even though u r deploying ur application with war file? Bosch 3
what are the disadvantages of cookies?   8
Hi friends, am newbie to servlet. My interviewer asked why used servlet in your application. i used servlet for controller logic and business logic . is it correct ? TCS 5
How to work with Chinese login page (internationalization).if he enters user name and password in chinese, how is it converted to English and validate in db? And in reverse it should display welcome message in Chinese,if user is valid Bosch 4
how the jsp page can be regenerated? HCL 2
Explain life cycle of a Servlet?   2
 
For more Servlets Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com