Allah - bismiLlahir Rehmaanir Raheem - laailaha illaLlaho Muhammaddur rasooluLlah - Muhammad sallallahoalaihiwassallam

(Muhammad Faisal [MOBZFSL] SubtleSolo)

Home
Blog - 348 Posts Hot and Latest
Entertainment / Spicy Pics
Arrivals ...
Dynamic Links / Pages
Something Worth!
Allah's names
Muhammad's (saws) names
Interesting facts of Qura'an
Qura'an & Science
Holy Ka'aba - Makkah Pictures
Holy Madinah Pictures
Nature Pictures (Beauties)
Hamd-o-Naat - Downloads
For Non-Muslims
Picture - Photo Gallery
My Picture
Cute Innocence - Children
Amazing Pics. / Abstract Arts
Interesting / Funny Pictures
Technology Pics(Cars,Aero etc)
Air Force Pictures
Animations
Good Words / Thoughts / Cards
World Places
Nature Pics. (Traveling / Spicy)
Celebrity Gallery (Actors etc.)
Random Visuals
cng
cng

Show Next Visual
Entertainment Misc. Stuffs
Worth Readings - Lessons of Life
Beautyful lines (Quotes)
Love
Urdu Stuffs (Poetry/Articles etc)
Poetry Collection
Interesting Facts / Brain Teaser
Mind Reader
Medical / Health Lines
Fun Reading
Laugh Baby
Jokes
Games
Love SMS
Funny SMS
Dictionary(English-Urdu-Arabic)
Download Files (.ppt, .doc etc)
Songs List / Music
Downloads-Technical/Codes
Knowledge Base
Life Routine - Etiquettes
Business transactions
Fresh Engineers's Help
Interview Questions
C++
C Sharp
ASP .NET
Java
Servlets
Perl
XML
Oracle
Networking
SAP R-3
Testing - Quality Assurance
More topics... Click here
Visitor Book / Comments
Contact
Add to / Bookmark with:

     Facebook      Twitter  
     Mixx      Linkedin
     reddit      Digg
     Yahoo Buzz      Newsvine
     delicious      Fark 
    StumbleUpon 
     Google      Yahoo

Search
© 2001-2012 Muhammad Faisal. All rights reserved. | Disclaimer

   
  These material are compiled for helping junior / senior software engineers and others.

Servlet Interview Questions and Answers

1. What is Servlet?

A servlet is a Java technology-based Web component, managed by a container called servlet container or servlet engine, that generates dynamic content and interacts with web clients via a request\/response paradigm.

2. Why is Servlet so popular?

Because servlets are platform-independent Java classes that are compiled to platform-neutral byte code that can be loaded dynamically into and run by a Java technology-enabled Web server.

3. What is servlet container?

The servlet container is a part of a Web server or application server that provides the network services over which requests and responses are sent, decodes MIME-based requests, and formats MIME-based responses. A servlet container also contains and manages servlets through their lifecycle.

4. When a client request is sent to the servlet container, how does the container choose which servlet to invoke?

The servlet container determines which servlet to invoke based on the configuration of its servlets, and calls it with objects representing the request and response.

5. If a servlet is not properly initialized, what exception may be thrown?

During initialization or service of a request, the servlet instance can throw an UnavailableException or a ServletException.

6. Given the request path below, which are context path, servlet path and path info?

/bookstore/education/Default.aspx

context path: /bookstore
servlet path: /education
path info: /Default.aspx

7. What is filter? Can filter be used as request or response?

A filter is a reusable piece of code that can transform the content of HTTP requests,responses, and header information. Filters do not generally create a response or respond to a request as servlets do, rather they modify or adapt the requests for a resource, and modify or adapt responses from a resource.

8. When using servlets to build the HTML, you build a DOCTYPE line, why do you do that?

I know all major browsers ignore it even though the HTML 3.2 and 4.0 specifications require it. But building a DOCTYPE line tells HTML validators which version of HTML you are using so they know which specification to check your document against. These validators are valuable debugging services, helping you catch HTML syntax errors.

9. What is new in ServletRequest interface?(Servlet 2.4)

The following methods have been added to ServletRequest 2.4 version:
public int getRemotePort()
public java.lang.String getLocalName()
public java.lang.String getLocalAddr()
public int getLocalPort()


Sources :
DEVFYI - Developer Resource - FYI
TechGuider


Click here to get Interview's Topic Index


Click here for all latest additions. Posts (348)

A Muslim is he from whose tongue and hands, other Muslims are safe. (Muhammad - peace be upon him - sallallaho alaihi wassallam) (ref. Al-Bukharee, Vol 1 No 9, Muslim Vol 1 No 64 & Abu Dawud No 2475)

479772 hits. Comments here...