Friday, 17 February 2012

When a servlet accepts a call from a client, it receives two objects. What are they? | Java Servlets


ServeltRequest: which encapsulates the communication from the client to the server.
ServletResponse: which encapsulates the communication from the servlet back to the client.
ServletRequest and ServletResponse are interfaces defined by the javax.servlet package.

What’s the Servlet Interface? | Java Servlets

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.

What are the uses of Servlets? | Java Servlets


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.

What’s the advantages using servlets than using CGI? | Java Servlets


Servlets provide a way to generate dynamic documents that is both easier to write and faster to run. It is efficient, convenient, powerful, portable, secure and inexpensive. Servlets also address the problem of doing server-side programming with platform-specific APIs: they are developed with Java Servlet API, a standard Java extension.

What’s the difference between servlets and applets? | Java Servlet


Servlet is the server side component and the applet is the client side component.applet makes the request to the servlet and servlet is the server which responed that request

What is the servlet? | Java Servlets


Servlets are modules that extend request/response-oriented servers, such as Java-enabled web servers. For example, a servlet may be responsible for taking data in an HTML order-entry form and applying the business logic used to update a company’s order database.

TOP 25 Java Servlets Interview Questions and Answers for Freshers

Basic Java servlet interview questions and answers pdf free download

1. What is the servlet?
2 . What’s the difference between servlets and applets?
3. What’s the advantages using servlets than using CGI?
4 . What are the uses of Servlets?
5. What’s the Servlet Interface?
6 . When a servlet accepts a call from a client, it receives two objects. What are they?
7 .What is Java Servlet?
8 . Why is Servlet so popular?
9. What is servlet container?
10 . When a client request is sent to the servlet container, how does the container choose which servlet to invoke?
11. If a servlet is not properly initialized, what exception may be thrown?
12. What is filter? Can filter be used as request or response?
13. When using servlets to build the HTML, you build a DOCTYPE line, why do you do that?
14. What is new in ServletRequest interface?
15. Request parameter How to find whether a parameter exists in the request object?
16. How can I send user authentication information while makingURLConnection?
17. Can we use the constructor, instead of init(), to initialize servlet?
18. How can a servlet refresh automatically if some new data has entered the database?
19. The code in a finally clause will never fail to execute, right?
20. What mechanisms are used by a Servlet Container to maintain session information?
21. Difference between GET and POST in Java Servlets?
22. What is Java Servlet session?
23. What is servlet mapping?
24. What is servlet context ?