Sponsored Links

Interview Questions
Recommended Books












INTERVIEW QUESTIONS J2EE SERVLET DETAILS
Question :

What is the difference between servlets and jsp?

Posted by: Mk on 11/18/2012


Contact Mk Contact Mk

Category Servlet Interview Questions
Rating (3.6) By 59 users
Added on 11/18/2012
Views 2815
Rate it!

Highly Recommended, Hand Picked Servlet Books



Question :

What is the difference between servlets and jsp?


Answer:

In servlet,java will be used to generate dynamic HTML pages,but in JSP,java will be reduced and we can use our custom tags to generate HTML pages.
Source: CoolInterview.com



Posted by: olymohamed

Contact olymohamed Contact olymohamed

In servlet if any change in your class file you must redeploy again but jsp only one you have to deploy. in compare to servlet jsp reduce code and contains implicit objects.
Source: CoolInterview.com



Posted by: chitra

Contact chitra Contact chitra

Question:
What is the difference between servlets and Java Server Pages? Which is preferred?
Answer:
Servlets and Java Server Pages are complementary APIs, both providing a means for generating dynamic Web content. A servlet is a Java class implementing the javax.servlet.Servlet interface that runs within a Web or application server's servlet engine, servicing client requests forwarded to it through the server. A Java Server Page is a slightly more complicated beast. JSP pages contain a mixture of HTML, Java scripts (not to be confused with JavaScript), JSP elements, and JSP directives. The elements in a Java Server Page will generally be compiled by the JSP engine into a servlet, but the JSP specification only requires that the JSP page execution entity follow the Servlet Protocol.

The advantage of Java Server Pages is that they are document-centric. Servlets, on the other hand, look and act like programs. A Java Server Page can contain Java program fragments that instantiate and execute Java classes, but these occur inside an HTML template file and are primarily used to generate dynamic content. Some of the JSP functionality can be achieved on the client, using JavaScript. The power of JSP is that it is server-based and provides a framework for Web application development. Rather than choosing between servlets and Java Server Pages, you will find that most non-trivial applications will want to use a combination of JSP and servlets. In fact, the JSP 1.1 and Servlet 2.2 specifications are based around the concept of the Web application, combining the two APIs into a unified framework.


Source: CoolInterview.com



Posted by: hariharan

Contact hariharan Contact hariharan

Servlets-
(1)Bits of HTML embedded in java code.(2) Suitable for coding business layer of enterprise application.(3)Created and maintained by Java programmers

JSP-
(1) Bits of java code embedded in HTML.
(2)Suitable for coding presentation layer of enterprise application
(3)Created and maintained by Web designers.
Source: CoolInterview.com



Posted by: Margi Pancholi

Contact Margi Pancholi Contact Margi Pancholi

JSP page has both presentation logic and business logic but servlet has only business logic and presentation logic is present in html file
Source: CoolInterview.com



Posted by: sai

Contact sai Contact sai

Jsp is nothing but a servlet.jsp is transfered to servlet by jsp engine.after converting it acts like a servlet.in servlets static content and dynamic content are combined.we can avoid this using jsp.we can separate static content from dynamic content.so this makes the application very flexible.
Source: CoolInterview.com



Posted by: ranjith

Contact ranjith Contact ranjith

servlets will allow only java code ie other than java code like html,javascript can be written in out.println()statements only.but,jsp allows us code other than java also.jsp dirctly allows us to write templet text,scripts,jstl,java code
Source: CoolInterview.com



Posted by: ranjith

Contact ranjith Contact ranjith

In jsp html pages with javacode embedded inside of them.In servlets java programs with html embedded inside of them.
Source: CoolInterview.com



Posted by: priya.s

Contact priya.s Contact priya.s

In servlet java code can't embedded wih servlet's custome tag.
In jsp java code can embedded with jsp's custome tag
Source: CoolInterview.com



Posted by: Baskar

Contact Baskar Contact Baskar

JSP contains more static content and less dynamic content but servlet contains more dynamic and less static content.
Source: CoolInterview.com



Posted by: muthu

Contact muthu Contact muthu

Servlet contains very indepth coding to develop any servlet web application.And also all logics are implemented in same servlets we get page centric problem.There is no implicits objects and by default servlet is not a threadsafe.It is not participating session by default.javax.servlet package.

when compare to servlets....
In jsp,Indepth java coding is reduced because of custom tags is used.And Business,Data acess logics are developed in different webpages.It means presentation logics are developed in jsp page and data acess logic developed in JavaBean class.It eliminates pagecentric problem. Jsp have its own implicit objects provided by container.Bydefault its participating in session.It is the subpackage of javax.servlet.jsp package.But both are available in same server.
Source: CoolInterview.com



Posted by: venkateswara reddy gunapati

Contact venkateswara reddy gunapati Contact venkateswara reddy gunapati

servlet:-1)mainly for business logic.
2)once compled a servlet,if any modifications then once again complie and re-deploy.
3)no implicit objects.

jsp:-1)mainly for presentation logic.
2)want to make changes go to the source jsp file and make changes,not need any recompilation.
3)implicit objects are there.

**** jsp== servlet ****

because,even if u write any jsp file at the back a servlet will be generated.
(for example if u r using tomcat as server then in "work directory "of tomcat there u can find the servlet.
Source: CoolInterview.com



Posted by: M.Santosh Kumar

Contact M.Santosh Kumar Contact M.Santosh Kumar

servlet is runs on the server.It has only business logic. jsp is mixing of html and java.
JSP page has both presentation logic and business logic.
Source: CoolInterview.com



Posted by: Rahman khan

Contact Rahman khan Contact Rahman khan

If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
  • There should not be any Spelling Mistakes.
  • There should not be any Gramatical Errors.
  • Answers must not contain any bad words.
  • Answers should not be the repeat of same answer, already approved.
  • Answer should be complete in itself.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification Enter the above shown code: *
Inform me about updated answers to this question

Related Questions
View Answer
how do you compile servlet program?
View Answer
Why init is used and not constructor for servlets initialization?

View Answer
How can we refresh the servlet for every 2 minutes automatically?

View Answer
What is servlet ,what is the use of it?

View Answer
How can a web container know whether cookies are accepted or not accepted by the browser

View Answer
What is pure servlet?

View Answer
What is the diff b/w doGet() and service() method?

View Answer
When destroy method get call, will it call for each user please give the ans in detail?

View Answer
Can we use any other technology than JSP to construct a view ?

View Answer
When we are saving form bean ,What is the difference between session scope and request scope.

View Answer
How to build struts in java?
What are the function of struts?

View Answer
How can i pass info from dyna form bean to Entity Bean(CMP)

View Answer
What is the actual difference between MVC and MVC Model2




View Answer
In which pattern does all the action classes in the struts are organized

View Answer
What is the use of findbyprimarykey()?

View Answer
What is difference between Design Pattern and FrameWork.

View Answer
What is the difference between servlet context and servlet config




View Answer
Whats meant by struts?how to use struts in IBM websphere appli. ?
and how to managed with struts?(plz answer simply just an intro. don't go very deep)

View Answer
I have linux OS.I installed Tomcat 4. in Linux.
Now, i have to deploy My web application into that using WAR
file.

Please tell me steps....and also steps for the creating the WAR file too.

View Answer
What is the difference between Apache struts and Jakarta Struts?? why there are 2 names??

View Answer

Please Note: We keep on updating better answers to this site. In case you are looking for Jobs, Pls Click Here Vyoms.com - Best Freshers & Experienced Jobs Website.

View ALL Servlet Interview Questions & Answers



User Options
India News Network

Latest 20 Questions
What are the Hadoop related Projects at Apache?
What are the modules included in Apache Hadoop Project?
What is Apache Hadoop?
What is a Private Cloud? Do we need one to handle Big Data?
How Can We Cope with the Impact of Big Data?
What skills do Big Data analysts need to have?
What does a Big Data analyst do?
What are some real-world examples of Big Data and how it is used?
What is Big Data Analytics?
Why Big Data is becoming so important?
What is the impact of Big Data on Sports Industry?
What is the impact of Big Data on Real estate Industry?
What is the impact of Big Data on Retail Banking Industry?
What is the impact of Big Data on Retail Industry?
What is the impact of Big Data on Technology Industry?
What is the impact of Big Data on Information Technology Industry?
What is the impact of Big Data on Internet of Things (IoT) Industry?
What is the impact of Big Data on Media Industry?
What is the impact of Big Data on Education Industry?
What is the impact of Big Data on Healthcare Industry?



Fresher Jobs | Experienced Jobs | Government Jobs | Walkin Jobs | Company Profiles | Interview Questions | Placement Papers | Companies In India | Consultants In India | Colleges In India | Exams In India | Latest Results | Notifications In India | Call Centers In India | Training Institutes In India | Job Communities In India | Courses In India | Jobs by Keyskills | Jobs by Functional Areas

Testing Articles | Testing Books | Testing Certifications | Testing FAQs | Testing Downloads | Testing Interview Questions | Testing Jobs | Testing Training Institutes

Gate Articles | Gate Books | Gate Colleges | Gate Downloads | Gate Faqs | Gate Jobs | Gate News | Gate Sample Papers | Gate Training Institutes

MBA Articles | MBA Books | MBA Case Studies | MBA Business Schools | MBA Current Affairs | MBA Downloads | MBA Events | MBA Notifications | MBA FAQs | MBA Jobs
MBA Job Consultants | MBA News | MBA Results | MBA Courses | MBA Sample Papers | MBA Interview Questions | MBA Training Institutes

GRE Articles | GRE Books | GRE Colleges | GRE Downloads | GRE Events | GRE FAQs | GRE News | GRE Training Institutes | GRE Sample Papers

IAS Articles | IAS Books | IAS Current Affairs | IAS Downloads | IAS Events | IAS FAQs | IAS News | IAS Notifications | IAS UPSC Jobs | IAS Previous Question Papers
IAS Results | IAS Sample Papers | IAS Interview Questions | IAS Training Institutes | IAS Toppers Interview

SAP Articles | SAP Books | SAP Certifications | SAP Companies | SAP Study Materials | SAP Events | SAP FAQs | SAP Jobs | SAP Job Consultants
SAP Links | SAP News | SAP Sample Papers | SAP Interview Questions | SAP Training Institutes |




Copyright ©2003-2016 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions



Cache = 0 Seconds