Sponsored Links

Interview Questions



INTERVIEW QUESTIONS J2EE SERVLET DETAILS

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.

Category Servlet Interview Questions & Answers - Exam Mode / Learning Mode
Rating (0.3) By 7531 users
Added on 11/18/2012
Views 73894
Rate it!

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

Answered by: olymohamed | Date: 12/12/2007 | 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

Answered by: chitra | Date: 12/14/2007 | 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

Answered by: hariharan | Date: 12/15/2007 | 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

Answered by: Margi Pancholi | Date: 12/17/2007 | 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

Answered by: sai | Date: 12/17/2007 | 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

Answered by: ranjith | Date: 12/24/2007 | 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

Answered by: ranjith | Date: 12/25/2007 | 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

Answered by: priya.s | Date: 1/3/2008 | 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

Answered by: Baskar | Date: 9/9/2008 | 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

Answered by: muthu | Date: 12/19/2008 | 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

Answered by: venkateswara reddy gunapati | Date: 6/7/2010 | 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

Answered by: M.Santosh Kumar | Date: 8/10/2010 | 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

Answered by: Rahman khan | Date: 8/11/2010 | 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 - Exam Mode / Learning Mode



User Options
India News Network

Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal



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-2025 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions