InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
What Is Unicastremoteobject? |
|
Answer» All remote objects must extend UNICASTREMOTEOBJECT, which PROVIDES functionality that is NEEDED to MAKE objects available from remote MACHINES. All remote objects must extend UnicastRemoteObject, which provides functionality that is needed to make objects available from remote machines. |
|
| 2. |
What Is Inet Address? |
|
Answer» EVERY COMPUTER connected to a network has an IP address. An IP address is a number that UNIQUELY identifies each computer on the Net. An IP address is a 32-bit number. Every computer connected to a network has an IP address. An IP address is a number that uniquely identifies each computer on the Net. An IP address is a 32-bit number. |
|
| 3. |
What Does A Thread Enter When It Terminates Its Processing? |
|
Answer» When a thread TERMINATES its PROCESSING, it ENTERS the DEAD state. When a thread terminates its processing, it enters the dead state. |
|
| 4. |
How To Deserialize Objects With Multiple References? |
|
Answer» When you deserialize OBJECTS that you have referenced MULTIPLE times, you should reconstruct the objects only once. You should use a HASHTABLE to keep track of objects that you must reconstruct. When you READ an object for the first time, you add the reference to the hashtable along with the object's ID value. If you encounter the object a second time, you use the reference that is stored in the hashtable. When you deserialize objects that you have referenced multiple times, you should reconstruct the objects only once. You should use a hashtable to keep track of objects that you must reconstruct. When you read an object for the first time, you add the reference to the hashtable along with the object's ID value. If you encounter the object a second time, you use the reference that is stored in the hashtable. |
|
| 5. |
How To Serialize Objects With Multiple References? |
|
Answer» When you serialize objects that your program REFERENCES MULTIPLE times, you should write the object only one time. To do this, you can use a hashtable to keep track of the object that you have written. When you write an object for the first time, you add its REFERENCE to the hashtable along with a unique ID value. The ID can be any numeric value. You write the object's CLASS name and ID value to the stream, followed by the object itself. If your program encounters the object a second time, you only write the name of the object and ID value to the stream. When you serialize objects that your program references multiple times, you should write the object only one time. To do this, you can use a hashtable to keep track of the object that you have written. When you write an object for the first time, you add its reference to the hashtable along with a unique ID value. The ID can be any numeric value. You write the object's class name and ID value to the stream, followed by the object itself. If your program encounters the object a second time, you only write the name of the object and ID value to the stream. |
|
| 6. |
What Is The Java.sql.timestamp Class? |
|
Answer» Within a JAVA DATABASE, you can use the TIMESTAMP type to store a TIME with a resolution in nanoseconds. Java's Date class, on the other hand, only measures to milliseconds. Therefore, the JDBC developers have made a java.sql.Timestamp class. This new Timestamp class EXTENDS the java.util. Date class by adding a nanosecond variable to store the time-stamp information. Within a Java database, you can use the TIMESTAMP type to store a time with a resolution in nanoseconds. Java's Date class, on the other hand, only measures to milliseconds. Therefore, the JDBC developers have made a java.sql.Timestamp class. This new Timestamp class extends the java.util. Date class by adding a nanosecond variable to store the time-stamp information. |
|
| 7. |
How To Set A Parameter To Null? |
|
Answer» As you have learned within a DATABASE, the null value is a valid field value. Sometimes, depending on your database contents, you will want to set a parameter within a PREPARE statement to null There are TWO WAYS that you can do this. FIRST, you can pass null as an argument to any of the setx methods. The JDBC, in turn, will set the data field to null. Second, you can call the setNull method. As you have learned within a database, the null value is a valid field value. Sometimes, depending on your database contents, you will want to set a parameter within a prepare statement to null There are two ways that you can do this. First, you can pass null as an argument to any of the setx methods. The JDBC, in turn, will set the data field to null. Second, you can call the setNull method. |
|
| 8. |
How Applet Restrictions Affect Jdbc? Explain. |
|
Answer» As you have learned, a Java applet can only connect to the server from which the user downloaded the applet. In addition, some browser, such as Netscape, do not let an applet write or read LOCAL FILES. THEREFORE, a database applet cannot write search result to a file or insert data into a database. You must take these restrictions into CONSIDERATION when you design an applet that is going to access a database. As you have learned, a Java applet can only connect to the server from which the user downloaded the applet. In addition, some browser, such as Netscape, do not let an applet write or read local files. Therefore, a database applet cannot write search result to a file or insert data into a database. You must take these restrictions into consideration when you design an applet that is going to access a database. |
|
| 9. |
Explain The Sql? |
|
Answer» SQL (Structured Query Language) is a high-level language that hides particular relational database's implementation. SQL provides a standard database interface. Using SQL, your program is not stuck with one particular vendor's database management system (DBMS). Ideally, you can change from one DBMS to another without CHANGING your APPLICATION. In reality, HOWEVER, each vendor's interpretation of SQL is slightly different, so switching from one DBMS to another NORMALLY requires some work. SQL is officially pronounced "ess-cue-ell," but most people call it "sequel." You use SQL to interact with relational databases. There are three main operations that you may want to perform with a database: database MANIPULATION, definition, and administration. We shall focus on database manipulation, that is, data retrieval and modification. The other operations database definition and administration, correspond to database creation and management, which most users are not in a position to perform. SQL (Structured Query Language) is a high-level language that hides particular relational database's implementation. SQL provides a standard database interface. Using SQL, your program is not stuck with one particular vendor's database management system (DBMS). Ideally, you can change from one DBMS to another without changing your application. In reality, however, each vendor's interpretation of SQL is slightly different, so switching from one DBMS to another normally requires some work. SQL is officially pronounced "ess-cue-ell," but most people call it "sequel." You use SQL to interact with relational databases. There are three main operations that you may want to perform with a database: database manipulation, definition, and administration. We shall focus on database manipulation, that is, data retrieval and modification. The other operations database definition and administration, correspond to database creation and management, which most users are not in a position to perform. |
|
| 10. |
What Is Relational Database? |
|
Answer» Either as a programmer or a user, you have probably interacted with a database before. A database is simply a program that makes it easy to store and retrieve data. The data can be numeric, string or more complex objects, such as a video database. A relational database is one implementation of a database—one that organizes data in tables. A table is made up of rows and COLUMNS. In relational database terminology, the table is called a FILE, a row is called a record and a column is called afield. One of the features of a relational database is that you can retrieve the data by its content. For example, assume you have a relational database with a table made up of two fields, one for names and ANOTHER for PHONE numbers. To retrieve data by content means that you can simply ask the database to retrieve a phone number for a particular name. You do not have to specify an explicit row and column to get a data element. Either as a programmer or a user, you have probably interacted with a database before. A database is simply a program that makes it easy to store and retrieve data. The data can be numeric, string or more complex objects, such as a video database. A relational database is one implementation of a database—one that organizes data in tables. A table is made up of rows and columns. In relational database terminology, the table is called a file, a row is called a record and a column is called afield. One of the features of a relational database is that you can retrieve the data by its content. For example, assume you have a relational database with a table made up of two fields, one for names and another for phone numbers. To retrieve data by content means that you can simply ask the database to retrieve a phone number for a particular name. You do not have to specify an explicit row and column to get a data element. |
|
| 11. |
How To Call A Stored Procedure From Jdbc? |
|
Answer» The first step is to create a CALLABLESTATEMENT object. As with Statement an and PreparedStatement objects, this is done with an OPEN Connection object. A CallableStatement object CONTAINS a call to a STORED procedure. The first step is to create a CallableStatement object. As with Statement an and PreparedStatement objects, this is done with an open Connection object. A CallableStatement object contains a call to a stored procedure. |
|
| 12. |
I Am A Current Scsl Licensee, And Want To Use The Cddl. Can I Do This? |
|
Answer» Yes. CURRENT SCSL licensees can choose to use the CDDL, but they MUST click through the NEW license, and use the CDDL notification in their WORK. Yes. Current SCSL licensees can choose to use the CDDL, but they must click through the new license, and use the CDDL notification in their work. |
|
| 13. |
What Are The Licensing Terms? |
|
Answer» The OSI-approved CDDL license is being used for project GlassFish which ALLOWS developers to view, use, edit, and alter the code, and DISTRIBUTE it or use it in production. Portions of this code are not yet available in source form. Because of this, a few portions are currently also under a Binary Distribution License. As time goes on, we’ll make more of the code available, with the eventual goal of making all the code available, and removing the Binary Distribution license. This isn’t some sort of evil plot – it’s hard work moving stuff out into an Open environment, we expect to have a roadmap for our timing for this published by the END of the Summer. PEOPLE who want to REDISTRIBUTE a build of our application server do not have a license to use the CTS nor can they use the Java Compatibility brand. They may choose to sign a JDL commercial license and pass the CTS which would then allow them to distribute the code and use the Java Compatibility brand. The OSI-approved CDDL license is being used for project GlassFish which allows developers to view, use, edit, and alter the code, and distribute it or use it in production. Portions of this code are not yet available in source form. Because of this, a few portions are currently also under a Binary Distribution License. As time goes on, we’ll make more of the code available, with the eventual goal of making all the code available, and removing the Binary Distribution license. This isn’t some sort of evil plot – it’s hard work moving stuff out into an Open environment, we expect to have a roadmap for our timing for this published by the end of the Summer. People who want to redistribute a build of our application server do not have a license to use the CTS nor can they use the Java Compatibility brand. They may choose to sign a JDL commercial license and pass the CTS which would then allow them to distribute the code and use the Java Compatibility brand. |
|
| 14. |
How Does This Impact Java Ee Licensees? |
|
Answer» Project GLASSFISH opens up Java EE to a larger audience that will ultimately be the customers of the Java EE licensees. GlassFish does not change any of the LICENSE TERMS for licensees. Under their license terms, licensees can still sell or distribute code and use the Java Compatibility brand for products which have passed the TCK. Under the license terms of the CDDL, which is granted to developers, they can use, EDIT, and alter the code, and distribute it or use it in PRODUCTION. However they do not have a license to use the CTS nor can they use the Java Compatibility brand. Project GlassFish opens up Java EE to a larger audience that will ultimately be the customers of the Java EE licensees. GlassFish does not change any of the license terms for licensees. Under their license terms, licensees can still sell or distribute code and use the Java Compatibility brand for products which have passed the TCK. Under the license terms of the CDDL, which is granted to developers, they can use, edit, and alter the code, and distribute it or use it in production. However they do not have a license to use the CTS nor can they use the Java Compatibility brand. |
|
| 15. |
What Is Being Released And When? |
|
Answer» In June of 2005, Sun published project GlassFish by making the web site available to the public. DEVELOPERS can ACCESS source code, nightly builds, discussion GROUPS, and mailing lists. This is the FIRST time developers were able to see and participate in the Application Server development process. Over the next 6 months, Sun will gradually roll out more information and more details about the code. Initially, access will be provided to the web-tier followed by other MODULES as GlassFish is developed. In June of 2005, Sun published project GlassFish by making the web site available to the public. Developers can access source code, nightly builds, discussion groups, and mailing lists. This is the first time developers were able to see and participate in the Application Server development process. Over the next 6 months, Sun will gradually roll out more information and more details about the code. Initially, access will be provided to the web-tier followed by other modules as GlassFish is developed. |
|
| 16. |
What Version Of Java Ee Does This Apply To? |
|
Answer» GLASSFISH will implement the latest version of the Java EE PLATFORM, Java EE 5, and the two should become final at around the same time. At that time Sun will also release a final, supported and COMPATIBLE Sun Java System APPLICATION Server PE 9.0 based on GlassFish. GlassFish will implement the latest version of the Java EE platform, Java EE 5, and the two should become final at around the same time. At that time Sun will also release a final, supported and compatible Sun Java System Application Server PE 9.0 based on GlassFish. |
|
| 17. |
How Often Can I Get An Update Of Glassfish? |
|
Answer» Updated builds for GlassFish will be posted every night to glassfish.dev.java.net. These code pushes have gone through very basic testing to ensure they will build and execute but have not been tested as thoroughly as our PRODUCTION releases. Additionally, you have read access to the same CVS tree that the developers do – so you always see the latest versions of the code there. Occasionally, typically weekly or so, we will push a “promoted” build which has been more thoroughly tested and will contain MANY more DOCUMENTED features than the regular nightly builds. A supported Beta and FCS version of the SUN Java SYSTEM Application Server 9.0 which is built on GlassFish. Updated builds for GlassFish will be posted every night to glassfish.dev.java.net. These code pushes have gone through very basic testing to ensure they will build and execute but have not been tested as thoroughly as our production releases. Additionally, you have read access to the same CVS tree that the developers do – so you always see the latest versions of the code there. Occasionally, typically weekly or so, we will push a “promoted” build which has been more thoroughly tested and will contain many more documented features than the regular nightly builds. A supported Beta and FCS version of the Sun Java System Application Server 9.0 which is built on GlassFish. |
|
| 18. |
Can I As A Developer Make Any Changes I Want To The Code? |
|
Answer» Yes, developers have free access to the source code under the TERMS of the Common Development and Distribution LICENSE (CDDL) v1.0 and are free to change it as they see fit. To be able to claim Java Compatibility, developers of COMMERCIAL distributions will need to sign the Java Developer License (JDL) and VERIFY the code passes the compatibility test suite (CTS) before they can redistribute it. Anyone can sign a contribution agreement and work on the code to contribute changes, bug fixes, and features. Yes, developers have free access to the source code under the terms of the Common Development and Distribution License (CDDL) v1.0 and are free to change it as they see fit. To be able to claim Java Compatibility, developers of commercial distributions will need to sign the Java Developer License (JDL) and verify the code passes the compatibility test suite (CTS) before they can redistribute it. Anyone can sign a contribution agreement and work on the code to contribute changes, bug fixes, and features. |
|
| 19. |
How Large Is The Glassfish Community? |
|
Answer» The GlassFish development community is just getting STARTED so it is small but rapidly growing. There are over 100 contributors already signed up. The NUMBER of Sun and Oracle engineers working on this PRODUCT is COMPARABLE in size to other application server developer communities today. With the release of project GlassFish to the community, we expect to greatly increase the number of developers working on the code. The GlassFish development community is just getting started so it is small but rapidly growing. There are over 100 contributors already signed up. The number of Sun and Oracle engineers working on this product is comparable in size to other application server developer communities today. With the release of project GlassFish to the community, we expect to greatly increase the number of developers working on the code. |
|
| 20. |
What Is Available On The Website? |
|
Answer» NIGHTLY builds and the source code for the application SERVER are available. As with other COMMUNITY development SITES, you will also find email lists, DISCUSSION forums, news, feedback, licensing information, and extensive help resources. Nightly builds and the source code for the application server are available. As with other community development sites, you will also find email lists, discussion forums, news, feedback, licensing information, and extensive help resources. |
|
| 21. |
What Is Project Glassfish? |
|
Answer» GlassFish is the name for the open SOURCE DEVELOPMENT project for building a Java EE 5 application server. It is based on the source code for Sun Java System Application Server PE 9 donated by Sun Microsystems and TOPLINK persistence code donated by Oracle. This project provides a structured process for developing a high quality application server that makes new features available faster than ever before. It is the response to Java developers who WANT access to the source code and the ability to contribute to the development of Sun’s next generation application server which is based on GlassFish. This project is designed to encourage communication between Sun and Oracle engineers and the community and will enable all developers to participate in the application server development process. GlassFish is the name for the open source development project for building a Java EE 5 application server. It is based on the source code for Sun Java System Application Server PE 9 donated by Sun Microsystems and TopLink persistence code donated by Oracle. This project provides a structured process for developing a high quality application server that makes new features available faster than ever before. It is the response to Java developers who want access to the source code and the ability to contribute to the development of Sun’s next generation application server which is based on GlassFish. This project is designed to encourage communication between Sun and Oracle engineers and the community and will enable all developers to participate in the application server development process. |
|
| 22. |
What Is Cdma One ? |
|
Answer» ALSO know as IS-95, CDMA One is a 2nd GENERATION wireless technology. Supports SPEEDS from 14.4Kbps to 115K bps. Also know as IS-95, CDMA One is a 2nd generation wireless technology. Supports speeds from 14.4Kbps to 115K bps. |
|
| 23. |
Explain How Servlets Differ From Rmi. Explain The Advantages And Disadvantages Of Each Technology. |
|
Answer» RMI (Remote Method Invocation) are a means of client server communication. In this, the client invokes a method on the server machine and the server machine process returns the result back to the client. We need to RUN RMI registry to use RMI. Servlets are used to extend the server side functionality of a website. They communicate with various application on the server side and respond to the REQUEST made by the client. Servlets are modules that run within the server and RECEIVE and respond to the requests made by the client. Servlets retrieve most of the PARAMETERS using the INPUT stream and send their responses using an output stream. RMI (Remote Method Invocation) are a means of client server communication. In this, the client invokes a method on the server machine and the server machine process returns the result back to the client. We need to run RMI registry to use RMI. Servlets are used to extend the server side functionality of a website. They communicate with various application on the server side and respond to the request made by the client. Servlets are modules that run within the server and receive and respond to the requests made by the client. Servlets retrieve most of the parameters using the input stream and send their responses using an output stream. |
|
| 24. |
List Out Difference Between A Javabean From A Servlet? |
|
Answer» Servlets are Java based analog to CGI programs, IMPLEMENTED by means of a servlet container associated with an HTTP server. Servlets RUN on the server side. Beans are reusable code components written in Java that ONE can use in a variety of programming environments. JavaBeans are to Java what ACTIVEX controls are to Microsoft. Javabeans can run on server side, client side, within an applet etc. Servlets are Java based analog to CGI programs, implemented by means of a servlet container associated with an HTTP server. Servlets run on the server side. Beans are reusable code components written in Java that one can use in a variety of programming environments. JavaBeans are to Java what ActiveX controls are to Microsoft. Javabeans can run on server side, client side, within an applet etc. |
|
| 25. |
List Out The Difference Between Servletconfig And Servletcontext? |
|
Answer» Both are interfaces in the package javax.servlet.
Both are interfaces in the package javax.servlet. |
|
| 26. |
Define Http Tunneling? |
|
Answer» In some organizations, the intranet is blocked by a firewall to the internet. It is exposed to the outer networks only by means of webserver port that accept only Http requests. In such situations, if PROTOCOLS other than http are USED, then they get rejected. The SOLUTION is to have them encapsulated in http or HTTPS and sent as an HttpRequest. Thus, masking other protocols as http requests is called HTTP TUNNELING. In some organizations, the intranet is blocked by a firewall to the internet. It is exposed to the outer networks only by means of webserver port that accept only Http requests. In such situations, if protocols other than http are used, then they get rejected. The solution is to have them encapsulated in http or https and sent as an HttpRequest. Thus, masking other protocols as http requests is called HTTP Tunneling. |
|
| 27. |
What Is The Difference Between An Applet And A Servlet? |
|
Answer» Applets
Servlets
Applets Servlets |
|
| 28. |
Is Possible To Have A Constructor For A Servlet? |
|
Answer» Yes, it is possible to have a constructor for a SERVLET. However, it is not practiced usually. The operations with the constructor can be performed as usual just that it cannot be called explicitly using the ‘new’ keyword. This is implicitly HANDLED by the servlet CONTAINER. THUS, the container performs initialization as well as constructor FUNCTIONS. Yes, it is possible to have a constructor for a servlet. However, it is not practiced usually. The operations with the constructor can be performed as usual just that it cannot be called explicitly using the ‘new’ keyword. This is implicitly handled by the servlet container. Thus, the container performs initialization as well as constructor functions. |
|
| 29. |
What Is The Genericservlet Class? |
|
Answer» GenericServlet MAKES writing servlets easier. To write a GENERIC servlet, all you NEED to do is to OVERRIDE the abstract SERVICE method. GenericServlet makes writing servlets easier. To write a generic servlet, all you need to do is to override the abstract service method. |
|
| 30. |
Explain Why Httpservlet Is Declared Abstract. |
|
Answer» The Constructor HttpServlet() does nothing because this is an ABSTRACT class. DEFAULT implementations in a few JAVA classes like HttpServlet don’t really do anything. Hence, they need to be overridden. Usually one of the following methods of HttpServlet must be overridden by a subclass: doGet, if the servlet supports HTTP GET requestsdoPost, HTTP POST requests doPut, HTTP PUT requests doDelete, HTTP DELETE requests init and destroy, to manage resources getServletInfo, to provide information HOWEVER, there doesn’t seem to be any reason why the SERVICE method should be overridden because it eventually dispatches the task to one of the doXXX methods. The Constructor HttpServlet() does nothing because this is an abstract class. Default implementations in a few Java classes like HttpServlet don’t really do anything. Hence, they need to be overridden. Usually one of the following methods of HttpServlet must be overridden by a subclass: However, there doesn’t seem to be any reason why the service method should be overridden because it eventually dispatches the task to one of the doXXX methods. |
|
| 31. |
What Are Different Authentication Options Available In Servlets? |
|
Answer» There are four ways of Authentication options available in SERVLETS There are four ways of Authentication options available in servlets |
|
| 32. |
Whats The Advantages Using Servlets Over Using Cgi? |
|
Answer» CGI programs run outside the webserver. So a new process must be STARTED to execute a CGI program. CGI programs are DESIGNED to handle a single request at a time. After that they return the result to the web server and EXIT. On the other hand servlets can handle MULTIPLE requests concurrently. They run WITHIN web servers. They generate dynamic content that is easier to write and faster to run. CGI programs run outside the webserver. So a new process must be started to execute a CGI program. CGI programs are designed to handle a single request at a time. After that they return the result to the web server and exit. On the other hand servlets can handle multiple requests concurrently. They run within web servers. They generate dynamic content that is easier to write and faster to run. |
|
| 33. |
What Are The General Advantages And Selling Points Of Servlets? |
|
Answer» Servlets exhibit the FOLLOWING characteristics:
Servlets exhibit the following characteristics: |
|
| 34. |
What Is Servlets And Explain The Advantages Of Servlet Life Cycle? |
|
Answer» Servlets are modules that run within the server and receive and respond to the requests made by the client. Servlets retrieve most of the PARAMETERS using the input STREAM and send their responses using an OUTPUT stream. Servlets are used to extend the server SIDE functionality of a website. They communicate with VARIOUS application on the server side and respond to the request made by the client. Servlets are modules that run within the server and receive and respond to the requests made by the client. Servlets retrieve most of the parameters using the input stream and send their responses using an output stream. Servlets are used to extend the server side functionality of a website. They communicate with various application on the server side and respond to the request made by the client. |
|
| 35. |
What Are The Objects That Are Received When A Servlets Accepts Call From Client? |
|
Answer» The objects are ServeltRequest and ServletResponse . The ServeltRequest ENCAPSULATES thecommunication from the CLIENT to the SERVER. While ServletResponse encapsulates the COMMUNICATION from the Servlet BACK to the client. The objects are ServeltRequest and ServletResponse . The ServeltRequest encapsulates thecommunication from the client to the server. While ServletResponse encapsulates the communication from the Servlet back to the client. |
|
| 36. |
What Are The Differences Between Servlet And Applet? |
|
Answer» Servlets are SERVER side components that runs on the Servlet container. APPLETS are CLIENT side components and runs on the web browsers. Servlets have no GUI INTERFACE. Servlets are server side components that runs on the Servlet container. Applets are client side components and runs on the web browsers. Servlets have no GUI interface. |
|
| 37. |
What Must Be Implemented By All Servlets? |
|
Answer» The SERVLET INTERFACE MUST be IMPLEMENTED by all SERVLETS. The Servlet Interface must be implemented by all servlets. |
|
| 38. |
What Do You Understand By Servlet Mapping? |
|
Answer» SERVLET mapping defines an ASSOCIATION between a URL pattern and a servlet. You can use ONE servlet to process a number of url pattern (request pattern). For EXAMPLE in case of STRUTS *.do url patterns are processed by Struts Controller Servlet. Servlet mapping defines an association between a URL pattern and a servlet. You can use one servlet to process a number of url pattern (request pattern). For example in case of Struts *.do url patterns are processed by Struts Controller Servlet. |
|
| 39. |
What Is Servletcontext? |
|
Answer» SERVLETCONTEXT is an INTERFACE that defines a SET of METHODS that a servlet uses to communicate with its servlet container, for example, to get the MIME type of a file, dispatch requests, or write to a log file. There is one context per "web application" per JAVA Virtual Machine. (A "web application" is a collection of servlets and content installed under a specific subset of the server's URL namespace such as /catalog and possibly installed via a .war file.) ServletContext is an Interface that defines a set of methods that a servlet uses to communicate with its servlet container, for example, to get the MIME type of a file, dispatch requests, or write to a log file. There is one context per "web application" per Java Virtual Machine. (A "web application" is a collection of servlets and content installed under a specific subset of the server's URL namespace such as /catalog and possibly installed via a .war file.) |
|
| 40. |
What Are The Directory Structure Of Web Application? |
|
Answer» Web component FOLLOWS the STANDARD DIRECTORY structure defined in the J2EE specification. Directory Structure of Web Component/ index.htm, JSP, Images ETC.. Web-inf web.xml classes servlet classes LIB jar files Web component follows the standard directory structure defined in the J2EE specification. |
|
| 41. |
What Are The Type Of Protocols Supported By Httpservlet? |
|
Answer» It extends the GENERICSERVLET BASE class and provides an framework for HANDLING the HTTP protocol. So, HttpServlet only supports HTTP and HTTPS protocol. It extends the GenericServlet base class and provides an framework for handling the HTTP protocol. So, HttpServlet only supports HTTP and HTTPS protocol. |
|
| 42. |
What Is Preinitialization Of A Servlet? |
|
Answer» A CONTAINER DOESNOT initialize the servlets ASS soon as it starts up, it initializes a servlet when it receives a request for that servlet first time. This is called lazy loading. The servlet specification defines the element, which can be SPECIFIED in the deployment descriptor to make the servlet container load and initialize the servlet as soon as it starts up. The process of loading a servlet before any request COMES in is called preloading or preinitializing a servlet. A container doesnot initialize the servlets ass soon as it starts up, it initializes a servlet when it receives a request for that servlet first time. This is called lazy loading. The servlet specification defines the element, which can be specified in the deployment descriptor to make the servlet container load and initialize the servlet as soon as it starts up. The process of loading a servlet before any request comes in is called preloading or preinitializing a servlet. |
|
| 43. |
Explain Servletcontext? |
|
Answer» ServletContext interface is a window for a servlet to view it's ENVIRONMENT. A servlet can use this interface to get information such as initialization parameters for the WEB applicationor servlet container's VERSION. Every web APPLICATION has one and only one ServletContext and is accessible to all active RESOURCE of that application. ServletContext interface is a window for a servlet to view it's environment. A servlet can use this interface to get information such as initialization parameters for the web applicationor servlet container's version. Every web application has one and only one ServletContext and is accessible to all active resource of that application. |
|
| 44. |
What Are The Common Mechanisms Used For Session Tracking? |
| Answer» | |
| 45. |
Explain The Directory Structure Of A Web Application? |
|
Answer» The directory structure of a WEB application consists of two parts.
WEB-INF folder consists of
The directory structure of a web application consists of two parts. WEB-INF folder consists of |
|
| 46. |
What Is The Difference Between The Getrequestdispatcher(string Path) Method Of Javax.servlet.servletrequest Interface And Javax.servlet.servletcontext Interface? |
|
Answer» The getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface ACCEPTS parameter the path to the resource to be included or forwarded to, which can be RELATIVE to the request of the calling servlet. If the path begins with a "/" it is INTERPRETED as relative to the current CONTEXT root. The getRequestDispatcher(String path) method of javax.servlet.ServletContext interface cannot accepts relative paths. All path must SART with a "/" and are interpreted as relative to curent context root. The getRequestDispatcher(String path) method of javax.servlet.ServletRequest interface accepts parameter the path to the resource to be included or forwarded to, which can be relative to the request of the calling servlet. If the path begins with a "/" it is interpreted as relative to the current context root. The getRequestDispatcher(String path) method of javax.servlet.ServletContext interface cannot accepts relative paths. All path must sart with a "/" and are interpreted as relative to curent context root. |
|
| 47. |
Explain The Life Cycle Methods Of A Servlet? |
|
Answer» The javax.servlet.Servlet interface defines the three methods known as life-cycle method. public void init(ServletConfig CONFIG) throws ServletExceptionpublic void service( ServletRequest REQ, ServletResponse RES) throws ServletException, IOException public void destroy() First the servlet is constructed, then initialized wih the init() method.Any request from client are handled initially by the service() method before delegating to thedoXxx() methods in the case of HttpServlet. The servlet is REMOVED from service, destroyed with the destroy() methid, then garbaged collected and FINALIZED. The javax.servlet.Servlet interface defines the three methods known as life-cycle method. First the servlet is constructed, then initialized wih the init() method.Any request from client are handled initially by the service() method before delegating to thedoXxx() methods in the case of HttpServlet. The servlet is removed from service, destroyed with the destroy() methid, then garbaged collected and finalized. |
|
| 48. |
Why Is It That We Can't Give Relative Url's When Using Servletcontext.getrequestdispatcher() When We Can Use The Same While Calling Servletrequest.getrequestdispatcher()? |
|
Answer» Since ServletRequest has the current REQUEST PATH to evaluae the relative path while ServletContext does not. Since ServletRequest has the current request path to evaluae the relative path while ServletContext does not. |
|
| 49. |
What Is The Difference Between Callling A Requestdispatcher Using Servletrequest And Servletcontext? |
|
Answer» We can GIVE relative URL when we use SERVLETREQUEST and not while USING SERVLETCONTEXT. We can give relative URL when we use ServletRequest and not while using ServletContext. |
|
| 50. |
Once The Destroy() Method Is Called By The Container, Will The Servlet Be Immediately Destroyed? What Happens To The Tasks(threads) That The Servlet Might Be Executing At That Time? |
|
Answer» YES, but Before calling the destroy() method, the SERVLET container WAITS for the remaining threads that are executing the servlet’s SERVICE() method to FINISH. Yes, but Before calling the destroy() method, the servlet container waits for the remaining threads that are executing the servlet’s service() method to finish. |
|