Tuesday 27 August 2013

Top Most Servlets Faqs

1) What is the servlet?
ANSWER : Servlets are modules that extend request/response-oriented servers, such as Java-enabled web servers. For example, a servlet might be responsible for taking data in an HTML order-entry form and applying the business logic used to update a company's order database.
Servlets are to servers what applets are to browsers. Unlike applets, however, servlets have no graphical user interface.
2) Whats the advantages using servlets than using CGI?
ANSWER : Servlets provide a way to generate dynamic documents that is both easier to write and faster to run. Servlets also address the problem of doing server-side programming with platform-specific APIs: they are developed with the Java Servlet API, a standard Java extension.
3) What are the uses of Servlets?
ANSWER : A servlet can handle multiple requests concurrently, and can synchronize requests. This allows servlets to support systems such as on-line conferencing.
Servlets can forward requests to other servers and servlets.Thus servlets can be used to balance load among several servers that mirror the same content, and to partition a single logical service over several servers, according to task type or organizational boundaries.
4) Which pakage provides interfaces and classes for writing servlets?
ANSWER : javax
5) Whats the Servlet Interfcae?
ANSWER : The central abstraction in the Servlet API is the Servlet interface. All servlets implement this interface, either directly or, more commonly, by extending a class that implements it such as HttpServlet.
Servlets-->Generic Servlet-->HttpServlet-->MyServlet.
The Servlet interface declares, but does not implement, methods that manage the servlet and its communications with clients. Servlet writers provide some or all of these methods when developing a servlet.
6) When a servlet accepts a call from a client, it receives two objects- What are they?
ANSWER : ServeltRequest: Which encapsulates the communication from the client to the server.
ServletResponse: Whcih encapsulates the communication from the servlet back to the client.
ServletRequest and ServletResponse are interfaces defined by the javax.servlet package.
7) What information that the ServletRequest interface allows the servlet access to?
ANSWER : Information such as the names of the parameters passed in by the client, the protocol (scheme) being used by the client, and the names of the remote host that made the request and the server that received it.
The input stream, ServletInputStream.Servlets use the input stream to get data from clients that use application protocols such as the HTTP POST and PUT methods.
8) What information that the ServletResponse interface gives the servlet methods for replying to the client?
ANSWER : It Allows the servlet to set the content length and MIME type of the reply.
Provides an output stream, ServletOutputStream and a Writer through which the servlet can send the reply data.
9) What is the servlet Lifecycle?
ANSWER : Each servlet has the same life cycle:
A server loads and initializes the servlet (init())
The servlet handles zero or more client requests (service())
The server removes the servlet (destroy())
(some servers do this step only when they shut down)
10) How HTTP Servlet handles client requests?
ANSWER : An HTTP Servlet handles client requests through its service method. The service method supports standard HTTP client requests by dispatching each request to a method designed to handle that request.





How do u deal property files in servlet?
What methods do u use in Servlet - Applet communication ?
What are the types of Servlet ?
Difference between HttpServlet and Generic Servlets ?
Difference between doGet and doPost ?
What are the methods in HttpServlet?
What are the types of SessionTracking?
What is Cookie ? Why is Cookie used ?
If my browser does not support Cookie,and my server sends a cookie instance What will happen ?
Why do u use Session Tracking in HttpServlet ?
Can u use javaScript in Servlets ?
What is the capacity the doGet can send to the server ?
What are the type of protocols used in HttpServlet ?
What is meant by a servlet ?
What are the types of servlets ? Explain
What is the different between a Servlet and a CGI?
What is the difference between 2 types of Servlets ?
What is the type of method for sending request from HTTP server ?
What are the exceptions thrown by Servlets ? Why ?
What is the life cycle of a servlet ?
What is meant by cookies ?
What is HTTP Session ?
What is the difference between GET and POST methods ?
How can you run a Servlet Program ?
How to commuincate between an applet and a servlet ?
What is a Servlet-to-Servlet communcation ?
What is Session Tracking ?
What are the security issues in Servlets ?
What is HTTP Tunneling?
How do you load an image in a Servlet ?
What is Servlet Chaining ?
What is URL Rewriting ?
What is context switching ?
How will you pass values from HTML page to the Servlet ?
What is Servlet API used for conneting database ?
In servlets, we are having a web page that is invoking servlets? Username and password ? which is cheks in the database ? Suppose the second page also If we want to verify the same information whethe it will connect to the database or it will be used previous information?
What are virtual functions ?
Write down how will you create a binary Tree ?
What are the traverses in Binary Tree ?
Write a program for recursive Traverse ?
What are session variable in Servlets ?
What is client server computing ?
What is meant by Servelet? What are the parameters of the Service Method ?
What is meant by Session ? Tell me something about HTTPSession Class ?
How do you invoke a Servelt? What is the difference in between DoPost and doGet methods ?
What is the difference in between the HTTPServlet and Generic Servlet?
Expalin their methods ? Tell me their parameter names also Have you used threads in Servelet ?
How do you load an Image in a Servlet ?
Explain Servlet Life cycle?
Why do you go for servlet rather than CGI

LinkWithin

Related Posts Plugin for WordPress, Blogger...

Labels

Core Java programming core java interview question Core Java Faq's Servlets coding database jsp-servlet spring Java linux unix interview questions java investment bank Web Services Interview investment bank mysql Senior java developer interviews best practices java collection tutorial RMI SQL Eclipse FIX protocol tutorial tibco J2EE groovy java questions SCJP grails java 5 tutorial jdbc beginner error and exception Design Patterns Java Programming Tutorials fundamentals general object oriented programming xml Java Programs Hibernate Examples Flex JAMon Java xml tutorial logging Jsp Struts 2.0 Sybase and SQL Server debugging java interviews performance FIX Protocol interview questions JUnit testing WebSphere date and time tutorial experienced java IO tutorial java concurrency thread Ejb Freshers Papers IT Management Java Exapmle Java Script SQL and database tutorial examples Scwcd ant tutorials concurrency example and tutorial future state homework java changes java threading tricky Agile Business of IT Development JSTL Java JSON tutorial Java multithreading Tutorials PM Scrum data structure and algorithm java puzzles java tips testing tips windows 8 5 way to create Singleton Object Architect Interview Questions and Answers Architecture Architecure Bluetooth server as swing application that searches bluetooth device in 10 meter circle and show all devices. You can send file to any bluetooth device. C Programming CIO Callable Statement in Java Circular dependency of Objects in Java Comparable Example in Collection Custom annotation in Java Developer Interview Divide and rule example in java Drupal Example of Singleton Pattern FIX protocol ForkJoin Example in Java 7 Get data from dynamic table with Java Script Git HTML and JavaScript Health Hello World TCP Client Server Networking Program Hibernate Basics Hibernate Interview Question Answer J2EE Interview Question And Answers J2ME GUI Program JEE Interview QA JMS interview question Java J2EE Hibernate Spring Struts Interview Question Java System Property Java Threads Manager Portlets Provident Fund Read data from any file in same location and give the required result. Reading Properties File in Java Redpoint Rest WebService Client Rest Webservice Test SAL join with ven diagram SCP UNIX COMMAND SSL Singleton Pattern in Java Spring Bean Initialization methods and their order Spring Interview Questions Struts Struts 2.0 Basics Struts 2.0 Design Pattern Submit Html Form With Java Script On The Fly Unix executable For Java Program XOM DOM SAX XP books computers core java; core java; object oriented programming data structure; java investment bank; design pattern dtd duplicate rows in table get browser name with jquery grails podcast inner class java beginners tutorial java cache java networking tutorial java spring java util; java collections; java questions java.java1.5 linked list mailto function with all browser oracle database oracle duplicate rows orm schema social spring mvc questions struts transaction tricks tweet windows xslt