JagooIndia
Forum of Indian Youth
JAVA INTERVIEW QUES
Core Java
JDBC
Servlet
JSP
Struts
EJB
JMS
J2ME
RMI
Spring
Seminar & Projects
Electronics
Electrical
Computer Science /IT
Mechanical
Civil
Marketing
Finance
Technical Certificarion
Sun
Oracle
Microsoft
IBM
Cisco
PMI
Domain Certifications
Finance
Insurance
Project Management
   
 

Servlet  Interview Questions

 
 
What is the servlet?
Servlet is a script, which resides and executes on server side, to create dynamic HTML. In servlet programming we will use java language. A servlet can handle multiple requests concurrently
What is the architechture of servlet package?
Servlet Interface is the central abstraction. All servlets implements this Servlet
Interface either direclty or indirectly
( may implement or extend Servlet Interfaces sub classes or sub interfaces)


Servlet
|
Generic Servlet
|
HttpServlet ( Class ) -- we will extend this class to handle GET / PUT HTTP requests
|
MyServlet
What is the difference between HttpServlet and GenericServlet?
A GenericServlet has a service() method to handle requests.
HttpServlet extends GenericServlet added new methods
doGet()
doPost()
doHead()
doPut()
doOptions()
doDelete()
doTrace() methods
Both these classes are abstract.
What's the difference between servlets and applets?
Servlets executes on Servers. Applets executes on browser. Unlike applets, however, servlets have no graphical user interface.
What are the uses of Servlets?
A servlet can handle multiple requests concurrently, and can synchronize requests. Servlets can forward requests to other servers and servlets. Thus servlets can be used to balance load among several servers.
When doGET() method will going to execute?
When we specified method='GET' in HTML
Example : < form name='SSS' method='GET'>
 
When doPOST() method will going to execute?
When we specified method='POST' in HTML
< form name='SSS' method='POST' >

 
What is the difference between Difference between doGet() and doPost()?
GET Method : Using get method we can able to pass 2K data from HTML
All data we are passing to Server will be displayed in URL (request string).

POST Method : In this method we does not have any size limitation.
All data passed to server will be hidden, User cannot able to see this info
on the browser.
What is the servlet life cycle?
When first request came in for the servlet , Server will invoke init() method of the servlet. There after if any user request the servlet program, Server will directly executes the service() method. When Server want to remove the servlet from pool, then it will execute the destroy() method
3333


 

NEXT

 
 
   © Copyright Jagoo India.com. All right reserved.