JavaBeat FAQs
Sponsors
JAVABEAT
Home
Articles
Tips
QnA
Forums
FAQs Topics Books Topic
Java Java Books
Struts Struts Books
Spring Spring Books
Hibernate Hibernate Books
JBoss Seam Seam Books
J2EE J2EE Books
EJB EJB Books
JSF JSF Books
Servlets Servlets Books
JDBC JDBC Books
RMI RMI Books
JMS JMS Books
JNI JNI Books
Design Patterns Patterns Books
Exception Exception Books
Apache Ant Ant Books
Groovy
Cobertura
Quartz

Java Servlet Interview Questions - 1

read more

1) Is it the "servlets" directory or the "servlet" directory?

2) How do I support both GET and POST protocol from the same Servlet?

3) How do I ensure that my servlet is thread-safe?

4) What is the difference between URL encoding, URL rewriting, HTML escaping, and entity encoding?

5) How do I upload a file to my servlet or JSP?

6) How does a servlet communicate with a JSP page?

7) What's a better approach for enabling thread-safe servlets and JSPs?

SingleThreadModel Interface or Synchronization?

8) Can a servlet maintain a JTA UserTransaction object across multiple servlet invocations?

9) How does the performance of JSP pages compare with that of servlets? How does it compare with Perl scripts?

10) How do I call one servlet from another servlet?

Java Servlet Interview Questions - 3

read more

21) How do you share session objects between servlets and JSP?

22) What is a servlet?

23) Is there any method to unload a servlet from Web Server memory without restarting the server?

24) What distinguishes a JavaBean from a Servlet?

25) How much data we can store in a session object?

26) What is the difference between the doGet and doPost methods?

27) What is the difference between encodeRedirectUrl and encodeURL?

28) Can I use System.exit() in servlets?

29) I am opening a single JDBC connection in my init() method. Do I need to synchronize on the Connection or the Statement object?

30) How can I determine the name and version number of the servlet or JSP engine that I am using?

Java Servlet Interview Questions - 5

read more

41) How do I handle FORMs with multiple form elements (e.g. radio buttons) using the same name?

42) How do I separate presentation (HTML) from business logic (Java) when using servlets?

43) For an HTML FORM with multiple SUBMIT buttons, how can a servlet ond differently for each button?

44) What is meant by the term "business logic"?

45) How can I explicitly unload a servlet or call the destroy method?

46) What is a servlet bean?

47) Why do we need to call super.init(config) in the init method of a servlet?

48) What is a servlet engine?

49) Which is the most efficient (i.e. processing speed) way to create a server application that accesses a database: A Servlet using JDBC; a JSP page using a JavaBean to carry out the db access; or JSP combined with a Servlet? Are these my only choices?

50) How can I change the port of my Java Web Server from 8080 to something else?

Java Servlet Interview Questions - 7

read more

61) Is there any way to determine the number of concurrent connections my servlet engine can handle?

62) What is a request dispatcher and how does it work?

63) What is a Servlet Context?

64) Does the RequestDispatcher expect a relative URL to be relative to the originally-called servlet or to the current servlet (if different)?

65) What is the difference between in-process and out-of-process servlet containers?

66) How is SingleThreadModel implemented in Tomcat? In other containers? [I would assume that Tomcat uses its connection thread pool, and creates a new instance of the servlet for each connection thread, instead of sharing one instance among all threads. Is that true?]

67) Which servlet containers have persistent session support? Specifically, does Tomcat 3.1?

68) Can I use JAAS as the authentication technology for servlets ?

69) How can I set a servlet to load on startup of the container, rather than on the first request?

70) Is it possible to write a servlet that acts as a FTP server?

Java Servlet Interview Questions - 9

read more

81) What is the difference between request attributes, session attributes, and ServletContext attributes?

82) Are singleton/static objects shared between servlet contexts?

83) When building web applications, what are some areas where synchronization problems arrise?

84) What is the difference between apache webserver, java webserver and tomcat server?

85) How can you embed a JavaScript within servlets / JSP pages?

86) How can I make a POST request through response.sendRedirect() or response.setStatus() and response.setHeader() methods?

87) How do I pass a request object of one servlet as a request object to another servlet?

88) I call a servlet as the action in a form, from a jsp. How can I redirect the response from the servlet, back to the JSP? (RequestDispatcher.forward will not help in this case, as I do not know which resource has made the request. request.getRequestURI will return the uri as contained in the action tag of the form, which is not what is needed.)

89) What is the ServletConfig object, and why is it useful?

90) I have a global variable in a servlet class. What will happen to this global variable if two requests hit on the same time?

Java Servlet Interview Questions - 2

read more

11) What are all the different kinds of servers? (Such as Web Servers, Application Servers, etc)

12) Should I override the service() method?

13) How can my application get to know when a HttpSession is removed (when it time-outs)?

14) Why use JSP when we can do the same thing with servlets?

15) How do I send information and data back and forth between applet and servlet using the HTTP protocol?

16) Can I get the path of the current servlet where it lives on the file system (not its URL)?

17) How can I daisy chain servlets together such that the output of one servlet serves as the input to the next?

18) Why there are no constructors in servlets?

19) How to handle multiple concurrent database requests/updates when using JDBC with servlets?

20) What is the difference between GenericServlet and HttpServlet?

Java Servlet Interview Questions - 4

read more

31) How can I get the absolute URL of a servlet/JSP page at runtime ?

32) Why do GenericServlet and HttpServlet implement the Serializable interface?

33) How does one choose between overriding the doGet(), doPost(), and service() methods?

34) How do servlets differ from RMI? What are the advantages and disadvantages of each technology?

35) How can we use a servlet as a proxy for communications between two applets?

36) How can I design my servlet/JSP so that query results get displayed on several pages, like the results of a search engine? Each page should display, say, 10 records each and when the next link is clicked, I should see the next/previous 10 records and so on.

37) How do I deal with multi-valued parameters in a servlet?

38) How can I pass data retrieved from a database by a servlet to a JSP page?

39) How can I use a servlet to generate a site using frames?

40) What is HTTP tunneling, in the general sense?

Java Servlet Interview Questions - 6

read more

51) Can I send multiple responses for a single request?

52) What is FORM based login and how do I use it? Also, what servlet containers support it?

53) How do I capture a request and dispatch the exact request (with all the parameters received) to another URL?

54) How can the data within an HTML form be refreshed automatically whenever there is a change in the database?

55) What is a web application (or "webapp")?

56) How can I call a servlet from a JSP page? How can I pass variables from the JSP that the servlet can access?

57) Can there be more than one instance of a servlet at one time ?

58) How can I measure the file downloading time using servlets?

59) What is inter-servlet communication?

60) How do I make servlet aliasing work with Apache+Tomcat?

Java Servlet Interview Questions - 8

read more

71) Is there a way to disable a user's ability to double-click a submit image/button (and therefore submitting duplicate data -- multiple submits)? Is there a way to do this with Javascript?

72) What are the main differences between Servlets and ISAPI?

73) Can I associate a servlet with a particular mime-type, so if the client requests a file of that type, my servlet will be executed?

74) What are the different cases for using sendRedirect() vs. getRequestDispatcher()?

75) How do I access the value of a cookie using JavaScript?

76) How do I write to a log file using JSP under Tomcat? Can I make use of the log() method for this?

77) How can I use a servlet to print a file on a printer attached to the client?

78) How do you do servlet aliasing with Apache and Tomcat?

79 ) I want my servlet page to redirect to a login page if the session has timed out. How can I know if my session has timed out?

80) Can Tomcat be configured to interpret all, or selected, .html files within a given context as JSP? Or, do JSP files have to end with a .jsp extension?

Java Servlet Interview Questions - 10

read more

91) Suppose I have 2 servers, server1 and server2. How can I take data in a cookie from server1, and send it to server2?

92) How can I pass data from a servlet running in one context (webapp) to a servlet running in another context?

93) How can I write an "error page" -- that is, a servlet or JSP to report errors of other servlets?

94) What is the difference between ServletContext and ServletConfig?

95) Under what circumstances will a servlet be reloaded?

96) What is a Servlet Filter?

97) I am using the RequestDispatcher's forward() method to redirect to a JSP. The problem is that the jsp's url is now relative to the servlet's url and all my url's in the jsp such as will be corrupt. How do I solve this problem?

98) How can I return a readily available (static) HTML page to the user instead of generating it in the servlet?

99) What is the difference between static variables and instance variables in a servlet?

100) How can I share data between two different web applications?


Sponsors
Webmaster Hosting Forum
Java Jobs
Latest in DLinks
http://javawave.blogspot.com/2008/04/quartz-job-scheduler-part-ii-example.html
Quartz Job Scheduler -- Part 1 (Setting up development project in Netbeans 6.1 beta)
Flex Messaging with BEA Workshop Studio
SOA and Virtualization: How do They Fit Together?
Introduction to Enterprise Portals - Why they Benefit IT and the Business
BEA WebLogic Operations Control: Application Virtualization for Enterprise Java
Best Practices for Building Production Quality EAR Files
BEA's SOA Reference Architecture - A Foundation for Business Agility
Blueprint for Successful SOA Integration
Guardian - What a tool!

JavaBeat Media (2004-2008), India
javabeat home | About Us
our network : opensource softwares
Copyright © 2007 JavaBeat