Java Interview Questions -22

Java Interview Questions -22

1.what are the different types of directives available in JSP?

The following are the different types of directives:

a. include directive : used to include a file and merges the content of the file with the current page
b. page directive : used to define page specific attributes like scripting language, error page, buffer, thread safety, etc
c. taglib : used to declare a custom tag library which is used in the page.

2.what are JSP actions?

JSP actions are executed when a JSP page is requested. Actions are inserted in the jsp page using XML syntax to control the behavior of the servlet engine. Using action, we can dynamically insert a file, reuse bean components, forward the user to another page, or generate HTML for the Java plugin. Some of the available actions are as follows:
<jsp: include> – include a file at the time the page is requested.
<jsp: useBean> – find or instantiate a JavaBean.
<jsp: setProperty> – set the property of a JavaBean.
<jsp: getProperty> – insert the property of a JavaBean into the output.
<jsp: forward> – forward the requester to a new page.
<jsp: plugin> – generate browser-specific code that makes an OBJECT or EMBED tag for the Java plugin.

3.what are Script lets?

Script lets are blocks of programming language code (usually java) embedded within a JSP page. Scriptlet code is inserted into the servlet generated from the page. Scriptlet code is defined between <% and %>

4.what are Decalarations?
Declarations are similar to variable declarations in Java. Variables are defined for subsequent use in expressions or script lets.

5.How to declare instance or global variables in jsp?
Instance variables should be declared inside the declaration part. The variables declared with JSP declaration element will be shared by all requests to the jsp page.

6.what are Expressions?
Expressions are variables or constants that are inserted into the data returned by the web server.

7.How will you invoke any external process in Java?
Runtime.getRuntime().exec(….)

8.What is the finalize method do?
Before the invalid objects get garbage collected, the JVM give the user a chance to clean up some resources before it got garbage collected.

9.What is mutable object and immutable object?

If a object value is changeable then we can call it as Mutable object. (Ex., StringBuffer, …) If you are not allowed to change the value of an object, it is immutable object. (Ex., String, Integer, Float, …)

10.what is meant by implicit objects? And what are they?

Implicit objects are those objects which are available by default. These objects are instances of classes defined by the JSP specification. These objects could be used within the jsp page without being declared.

The following are the implicit jsp objects:
1. application
2. Page
3. Request
4. Response
5. Session
6. Exception
7. Out
8. Config
9. Page Context


11.what is the difference between forward and send Redirect?

Both requestDispatcher.forward () and response.sendRedirect () is used to redirect to new url.Forward is an internal redirection of user request within the web container to a new URL without the knowledge of the user (browser). The request object and the http headers remain intact. send Redirect is normally an external redirection of user request outside the web container. send Redirect sends response header back to the browser with the new URL. The browser sends the request to the new URL with fresh http headers. send Redirect is slower than forward because it involves extra server call.

12.Can I create XML pages using JSP technology?

Yes, the JSP specification does support creation of XML documents. For simple XML generation, the XML tags may be included as static template portions of the JSP page. Dynamic generation of XML tags occurs through bean components or custom tags that generate XML output.

13.what are Directives?

Directives are instructions that are processed by the JSP engine when the page is compiled to a servlet. Directives are used to set page-level instructions, insert data from external files, and specify custom tag libraries.

14.How do I use Java Beans components (beans) from a JSP page?

The JSP specification includes standard tags for bean use and manipulation. The <jsp: useBean> tag creates an instance of a specific JavaBean class. If the instance already exists, it is retrieved. Otherwise, a new instance of the bean is created. The <jsp: setProperty> and <jsp: getProperty> tags let you manipulate properties of a specific bean.

15.What is the byte range?

-128 to 127

16.What is the implementation of destroy method in java.. is it native or java code?

This method is not implemented.

17.What is a package?

To group set of classes into a single unit is known as packaging. Packages provides wide namespace ability.

18.what is the difference between <jsp: include> and <%@include :>
Both are used to insert files into a JSP page.
<%@include :> is a directive which statically inserts the file at the time the JSP page is translated into a servlet.
<jsp: include> is an action which dynamically inserts the file at the time the page is requested.
Q.How is Java Server Pages different from Active Server Pages?

Ans: JSP is a community driven specification whereas ASP is a similar proprietary technology from Microsoft. In JSP, the dynamic part is written in Java, not Visual Basic or other MS-specific language. JSP is portable to other operating systems and non-Microsoft Web servers whereas it is not possible with ASP

19.Can’t JavaScript be used to generate dynamic content rather than JSP?
JavaScript can be used to generate dynamic content on the client browser. But it can handle only handles situations where the dynamic information is based on the client’s environment. It will not able to harness server side information directly.

20.How can I get to print the stacktrace for an exception occuring within my JSP page?

By printing out the exception’s stack trace, you can usually diagonse a problem better when debugging JSP pages. By looking at a stack trace, a programmer should be able to discern which method threw the exception and which method called that method. However, you cannot print the stacktrace using the JSP out implicit variable, which is of type JspWriter. You will have to use a PrintWriter object instead. The following snippet demonstrates how you can print a stacktrace from within a JSP error page:

     <%@ page isErrorPage=”true” %>

     <%

     out.println(“  “);

     PrintWriter pw = response.getWriter();

     exception.printStackTrace(pw);

     out.println(” “);

     %>


21.Is JSP technology extensible?
Yes. JSP technology is extensible through the development of custom actions, or tags, which are encapsulated in tag libraries.

22.How can I implement a thread-safe JSP page? What are the advantages and Disadvantages of using it?

You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This is done by adding the directive <%@ page isThreadSafe=”false” %> within your JSP page. With this, instead of a single instance of the servlet generated for your JSP page loaded in memory, you will have N instances of the servlet loaded and initialized, with the service method of each instance effectively synchronized. You can typically control the number of instances (N) that are instantiated for all servlets implementing SingleThreadModel through the admin screen for your JSP engine. More importantly, avoid using the <%! DECLARE %>tag for variables. If you do use this tag, then you should set isThreadSafe to true, as mentioned above. Otherwise, all requests to that page will access those variables, causing a nasty race condition. SingleThreadModel is not recommended for normal use. There are many pitfalls, including the example above of not being able to use <%! %>. You should try really hard to make them thread-safe the old fashioned way: by making them thread-safe

23.How does JSP handle run-time exceptions?

You can use the errorPage attribute of the page directive to have uncaught run-time exceptions automatically forwarded to an error processing page. For example: <%@ page errorPage=”error.jsp” %>
redirects the browser to the JSP page error.jsp if an uncaught exception is encountered during request processing. Within error.jsp, if you indicate that it is an error-processing page, via the directive: <%@ page isErrorPage=”true” %> Throwable object describing the exception may be accessed within the error page via the exception implicit object. Note: You must always use a relative URL as the value for the errorPage attribute.

24.What is garbage collection? What is the process that is responsible for doing that in java?

Reclaiming the unus
ed memory by the invalid objects. Garbage collector is responsible for this process

25.What kind of thread is the Garbage collector thread?

It is a daemon thread.

26.What is a daemon thread?

These are the threads which can run without user intervention. The JVM can exit when there are daemon thread by killing them abruptly.

27.What is the basic difference between string and stringbuffer object?
String is an immutable object. StringBuffer is a mutable object.

28.What is the purpose of Void class?

The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the primitive Java type void.

29.What is reflection?

reflection allows programmatic access to information about the fields, methods and constructors of loaded classes, and the use reflected fields, methods, and constructors to operate on their underlying counterparts on objects, within security restrictions.

30.What is the base class for Error and Exception?


Throwable

31.What are the approaches that you will follow for making a program very efficient?

By avoiding too much of static methods avoiding the excessive and unnecessary use of synchronized methods Selection of related classes based on the application (meaning synchronized classes for multiuser and non-synchronized classes for single user) Usage of appropriate design patterns Using cache methodologies for remote invocations Avoiding creation of variables within a loop and lot more.

32.What is a DatabaseMetaData?

Comprehensive information about the database as a whole.

33.What is the purpose of assert keyword used in JDK1.4.x?
In order to validate certain expressions. It effectively replaces the if block and automatically throws the AssertionError on failure. This keyword should be used for the critical arguments. Meaning, without that the method does nothing.

34.How will you get the platform dependent values like line separator, path separator, etc., ?

Using Sytem.getProperty(…) (line.separator, path.separator, …)

35.What is skeleton and stub? what is the purpose of those?
Stub is a client side representation of the server, which takes care of communicating with the remote server. Skeleton is the server side representation. But that is no more in use… it is deprecated long before in JDK.

36.What is the final keyword denotes?

final keyword denotes that it is the final implementation for that method or variable or class. You can’t override that method/variable/class any more.

37.What is the significance of ListIterator?
You can iterate back and forth.

38.What is the major difference between LinkedList and ArrayList?
LinkedList are meant for sequential accessing. ArrayList are meant for random accessing.

39.What is nested class?
If all the methods of a inner class is static then it is a nested class.

40.What is inner class?

If the methods of the inner class can only be accessed via the instance of the inner class, then it is called inner class.

41.What is composition?
Holding the reference of the other class within some other class is known as composition.

42.What is aggregation?
It is a special type of composition. If you expose all the methods of a composite class and route the method call to the composite method through its reference, then it is called aggregation.

43.What is Locale?

A Locale object represents a specific geographical, political, or cultural region

44.How will you load a specific locale?
Using ResourceBundle.getBundle(…);

45.What is JIT and its use?
Really, just a very fast compiler… In this incarnation, pretty much a one-pass compiler — no offline computations. So you can’t look at the whole method, rank the expressions according to which ones are re-used the most, and then generate code. In theory terms, it’s an on-line problem.

46.Is JVM a compiler or an interpreter?

Interpreter


47.When you think about optimization, what is the best way to findout the time/memory consuming process?

Using profiler

48.What are the methods in Object?
clone, equals, wait, finalize, getClass, hashCode, notify, notifyAll, toString

49.Can you instantiate the Math class?
You can’t instantiate the math class. All the methods in this class are static. And the constructor is not public.

50.What is singleton?
It is one of the design pattern. This falls in the creational pattern of the design pattern. There will be only one instance for that entire JVM. You can achieve this by having the private constructor in the class. For eg., public class Singleton { private static final Singleton s = new Singleton(); private Singleton() { } public static Singleton getInstance() { return s; } // all non static methods … }

51.What is DriverManager?

The basic service to manage set of JDBC drivers.

52.What is Class.forName() does and how it is useful?
It loads the class into the ClassLoader. It returns the Class. Using that you can get the instance ( “class-instance”.newInstance() ).

53.What do Enterprise JavaBeans components contain?
Enterprise JavaBeans components contains Business code, which is logic
that solves or meets the needs of a particular business domain such as banking, retail, or finance, is handled by enterprise beans running in the business tier. All the business code is contained inside an Enterprise Bean which receives data from client programs, processes it (if necessary), and sends it to the enterprise information system tier for storage. An enterprise bean also retrieves data from storage, processes it (if necessary), and sends it back to the client program.

54.Is J2EE application only a web-based?

No, It depends on type of application that client wants. A J2EE application can be web-based or non-web-based. if an application client executes on the client machine, it is a non-web-based J2EE application. The J2EE application can provide a way for users to handle tasks such as J2EE system or application administration. It typically has a graphical user interface created from Swing or AWT APIs, or a command-line interface. When user request, it can open an HTTP connection to establish communication with a servlet running in the web tier.

55.Are JavaBeans J2EE components?
No. JavaBeans components are not considered J2EE components by the J2EE specification. They are written to manage the data flow between an application client or applet and components running on the J2EE server or between server components and a database. JavaBeans components written for the J2EE platform have instance variables and get and set methods for accessing the data in the instance variables. JavaBeans components used in this way are typically simple in design and implementation, but should conform to the naming and design conventions outlined in the JavaBeans component architecture.

56.Is HTML page a web component?
No. Static HTML pages and applets are bundled with web components during application assembly, but are not considered web components by the J2EE specification. Even the server-side utility classes are not considered web components, either.

57.What can be considered as a web component?

J2EE Web components can be either servlets or JSP pages. Servlets are Java programming language classes that dynamically process requests and construct responses. JSP pages are text-based documents that execute as servlets but allow a more natural approach to creating static content.

58.What is the container?

Containers are the interface between a component and the low-level platform specific functionality that supports the component. Before a Web, enterprise bean, or application client component can be executed, it must be assembled into a J2EE application and deployed into its container.

59.What are container services?
A container is a runtime support of a system-level entity. Containers provide components with services such as lifecycle management, security, deployment, and threading.

60.What is the web container?

Servlet and JSP containers are collectively referred to as Web containers. It manages the execution of JSP page and servlet components for J2EE applications. Web components and their container run on the J2EE server.

61.What is Enterprise JavaBeans (EJB) container?

It manages the execution of enterprise beans for J2EE applications.
Enterprise beans and their container run on the J2EE server.

62.What is Applet container?

IManages the execution of applets. Consists of a Web browser and Java Plugin running on the client together.

63.How do we package J2EE components?

J2EE components are packaged separately and bundled into a J2EE application for deployment. Each component, its related files such as GIF and HTML files or server-side utility classes, and a deployment descriptor are assembled into a module and added to the J2EE application. A J2EE application is composed of one or more enterprise bean,Web, or application client component modules. The final enterprise solution can use one J2EE application or be made up of two or more J2EE applications, depending on design requirements. A J2EE application and each of its modules has its own deployment descriptor. A deployment descriptor is an XML document with an .xml extension that describes a component’s deployment settings.

64.What is a thin client?

A thin client is a lightweight interface to the application that does not have such operations like query databases, execute complex business rules, or connect to legacy applications.

65.What are types of J2EE clients?

Following are the types of J2EE clients:
Applets
Application clients
Java Web Start-enabled rich clients, powered by Java Web Start technology.
Wireless clients, based on Mobile Information Device Profile (MIDP) technology.
What is deployment descriptor? - A deployment descriptor is an Extensible Markup Language (XML) text-based file with an .xml extension that describes a component’s deployment settings. A J2EE application and each of its modules has its own deployment descriptor. For example, an enterprise bean module deployment descriptor declares transaction attributes and security authorizations
for an enterprise bean. Because deployment descriptor information is declarative, it can be changed without modifying the bean source code. At run time, the J2EE server reads the deployment descriptor and acts upon the component accordingly.

66.What is the EAR file?
An EAR file is a standard JAR file with an .ear extension, named from Enterprise ARchive file. A J2EE application with all of its modules is delivered in EAR file.

67.What is JTA and JTS?

JTA is the abbreviation for the Java Transaction API. JTS is the abbreviation for the Jave Transaction Service. JTA provides a standard interface and allows you to demarcate transactions in a manner that is independent of the transaction manager implementation. The J2EE SDK implements the transaction manager with JTS. But your code doesn’t call the JTS methods directly. Instead, it invokes the JTA methods, which then call the lower-level JTS routines. Therefore, JTA is a high level transaction interface that your application uses to control transaction. and JTS is a low level transaction interface and ejb uses behind the scenes (client code doesn’t directly interact with JTS. It is based on object transaction service(OTS) which is part of CORBA.

68.What is JAXP?

JAXP stands for Java API for XML. XML is a language for representing and describing text-based data which can be read and handled by any program or tool that uses XML APIs. It provides standard services to determine the type of an arbitrary piece of data, encapsulate access to it, discover the operations available on it, and create the appropriate JavaBeans component to perform those operations.

69.What is J2EE Connector?

The J2EE Connector API is used by J2EE tools vendors and system integrators to create resource adapters that support access to enterprise information systems that can be plugged into any J2EE product. Each type of database or EIS has a different resource adapter. Note: A resource adapter is a software component that allows J2EE application components to access and interact with the underlying resource manager. Because a resource adapter is specific to its resource manager, there is typically a different resource adapter for each type of database or enterprise information system.

70.What is JAAP?

The Java Authentication and Authorization Service (JAAS) provides a way for a J2EE application to authenticate and authorize a specific user or group of users to run it. It is a standard Pluggable Authentication Module (PAM) framework that extends the Java 2 platform security architecture to support user-based authorization.

71.What is Java Naming and Directory Service?
The JNDI provides naming and directory functionality. It provides applications with methods for performing standard directory operations, such as associating attributes with objects and searching for objects using their attributes. Using JNDI, a J2EE application can store and retrieve any type of named Java object. Because JNDI is independent of any specific implementations, applications can use JNDI to access multiple naming and directory services, including existing naming and
directory services such as LDAP, NDS, DNS, and NIS.

72.What is Struts?

A Web page development framework. Struts combines Java Servlets, Java Server Pages, custom tags, and message resources into a unified framework. It is a cooperative, synergistic platform, suitable for development teams, independent developers, and everyone between.

73.How is the MVC design pattern used in Struts framework?
In the MVC design pattern, application flow is mediated by a central Controller. The Controller delegates requests to an appropriate handler. The handlers are tied to a Model, and each handler acts as an adapter between the request and the Model. The Model represents, or encapsulates, an application’s business logic or state. Control is usually then forwarded back through the Controller to the appropriate View. The forwarding can be determined by consulting a set of mappings, usually loaded from a database or configuration file. This provides a loose coupling between the View and Model, which can make an application significantly easier to create and maintain. Controller: Servlet controller which supplied by Struts itself; View: what you can see on the screen, a JSP page and presentation components; Model: System state and a business logic JavaBeans.


74.How do you access variables across the sessions.

Through ServletContext.

75.where the session data will store?

session objects

76.How do you communicate between the servlets.

a)servlet chaning
b)Servlet context(RequestDespatcher interface)

77.Can you send the mail from a servlet ,if yes tell how?

yes.using mail API

78.What is Servlet?

A servlet is a Java technology-based Web component, managed by a container called servlet container or servlet engine, that generates dynamic content and interacts with web clients via a request\/response paradigm.

79.Why is Servlet so popular?

Because servlets are platform-independent Java classes that are compiled to platform-neutral byte code that can be loaded dynamically into and run by a Java technology-enabled Web server.

80.What is servlet container?

The servlet container is a part of a Web server or application server that provides the network services over which requests and responses are sent, decodes MIME-based requests, and formats MIME-based responses. A servlet container also contains and manages servlets through their lifecycle.

81.When a client request is sent to the servlet container, how does the container choose .which servlet to invoke?

The servlet container determines which servlet to invoke based on the configuration of its servlets, and calls it with objects representing the request and response.

82.If a servlet is not properly initialized, what exception may be thrown?
During initialization or service of a request, the servlet instance can throw an UnavailableException or a ServletException

83.What is the difference between an applet and a servlet?

a) Servlets are to servers what applets are to browsers.
b) Applets must have graphical user interfaces whereas servlets have no graphical user
interfaces.

84.what is the lifecycle of a servlet.

Each Servlet has the same life cycle:
a) A server loads and initializes the servlet by init () method.
b) The servlet handles zero or more client’s requests through service( ) method.
c) The server removes the servlet through destroy() method.

85.What is the ServletConfig() and why are using ServletConfig ?

This interface is implemented by services in order to pass configuration information to a
servlet when it is first loaded.A service writer implementing this interface must write methods
for the servlet to use to get its initialization parameters and the context in which it is running.
public interface ServletConfig

86.what are the types of servlets.

Genereic Servlets,HttpServlets.

87.What is use of parseQueryString ?

Parses a query string and builds a hashtable of key-value pairs, where the values are arraysof strings. The query string should have the form of a string packaged by the GET or POST method.
(For example, it should have its key-value pairs delimited by ampersands (&) and its keys separated from its values by equal signs (=).)

88.what are the different methods in HttpServlet.
doGet(),doPost(),doHead,doDelete(),deTrace()

89.What is meant by the ServletContext() and use of the method ?

public interface ServletContext
The ServletContext interface gives servlets access to information about their environment ,and allows them to log significant events. Servlet writers decide what data to log. The interface is
implemented by services, and used byservlets. Different virtual hosts should have different servlet contexts.

90.What is the difference between GET and POST.

a) doGet() method is used to get information, while doPost( ) method is used for posting information.
b) doGet() requests can’t send large amount of information and is limited to 240-255 characters.However,doPost( )requests passes all of its data, of unlimited length.
c) A doGet( ) request is appended to the request URL in a query string and this allows the
exchange is visible to the client, whereas a doPost() request passes directly over the socket connection as part of its HTTP request body and the exchange are invisible to the client.

91.Why do you need both GET and POST method implementations in Servlet?

A single servlet can be called from differenr HTML pages,so Different method calls can
be possible.

92.When init() and Distroy() will be called.

init() is called whenever the servlet is loaded for the first time into the webserver.Destroy
will be called whenever the servlet is removed from the webserver.

93.Who is loading the init() method of servlet?

Web server

94.If you want to modify the servlet,will the Webserver need to be ShutDown.

No

95.What is the advantage of Servlets over other serverside technologies.

PlatForm independent, so once compiled can be used in any webserver.For different processes different threads will execute inbuilt mutithreaded.

96.What is Server-Side Includes (SSI)?

Server-Side Includes allows embedding servlets within HTML pages using a special servlet tag. In many servlets that support servlets, a page can be processed by the server to include output from servlets at certain
points inside the HTML page. This is accomplished using a special internal SSINCLUDE,which processes
the servlet tags. SSINCLUDE servlet will be invoked whenever a file with an. shtml extension is requested.
So HTML files that include server-side includes must be stored with an .shtml extension.

97.What is Single Threaded Model in Servlets and how is it useful give one practical example.

For every single user a differnt copy of this servlet is executed. Credit card transactions.

98.What is the uses Sessions ?

Its a part of the SessionTracking and it is for mainting the client state at server side.

99.What are the advantage of using Sessions over Cookies and URLReWriting?

Sessions are more secure and fast becasue they are stored at serverside. But Sessions has to be used combindly with Cookies or URLReWriting for mainting the client id that is sessionid at client side.
Cookies are stored at client side so some clients may disable cookies so we may not sure that the cookies which we are mainting may work or not but in sessions cookies are disable we can
maintain our sessionid using URLReWriting .In URLReWriting we can't maintain large data because it leads to network traffic and access
may bebecome slow.Where as in seesions will not maintain the data which we have to maintain instead we will maintain only the session id.

100.What is session tracking and how do you track a user session in servlets?
Session tracking is a mechanism that servlets use to maintain state about a series requests
from the same user across some period of time. The methods used for session tracking are:
a) User Authentication - occurs when a web server restricts access to some of its resources to only those clients that log in using a recognized username and password
b) Hidden form fields - fields are added to an HTML form that are not displayed in the client’sbrowser. When the form containing the fields is submitted, the fields are sent back to the server
c) URL rewriting - every URL that the user clicks on is dynamically modified or rewritten to include extra information. The extra information can be in the form of extra path information,added parameters or some custom, server-specific URL change.
d) Cookies - a bit of information that is sent by a web server to a browser and which can later be read back from that browser.
e) HttpSession- places a limit on the number of sessions that can exist in memory. This limit is set in the session.maxresidents property

101.What is Cookies and what is the use of Cookies ?

Cookies are used to get user agents (web browsers etc) to hold small amounts of state
associated with a user's web browsing.Later that infromation read by server

102.What are cookies and how will you use them?

Cookies are a mechanism that a servlet uses to have a client hold a small amount of stateinformation
associated with the user.
a) Create a cookie with the Cookie constructor:
public Cookie(String name, String value)
b) A servlet can send a cookie to the client by passing a Cookie object to the addCookie() method ofHttpServletResponse:public void HttpServletResponse.addCookie(Cookie cookie)
c) A servlet retrieves cookies by calling the getCookies() method of HttpServletRequest:
public Cookie[ ] HttpServletRequest.getCookie( ).

103.how many Cookies is supported to the host ?

User agents excepted to support twenty per host.And its take four Kilobytes each.

104.Why we are used setMaxAge() and getMaxAge() in Cookies ?
setMaxAge:public void setMaxAge(int expiry)
Sets the maximum age of the cookie.The cookie will expire after that many seconds have passed.Negative values indicate the default behaviour:the cookie is not stored persistently, and
will be deleted when the user agent exits.A zero value causes the cookie to be deleted.
getMaxAge():public int getMaxAge()
Returns the maximum specified age of the cookie. If none was specified, a negative value is returned, indicating the default behaviour described with setMaxAge.

105.What is the use of setComment and getComment methods in Cookies ?
setComment:If a user agent (web browser) presents this cookie to a user, the cookie's purpose will be described using this comment. This is not supported by version zero cookies.
public void setComment(String use){}
getComment:Returns the comment describing the purpose of this cookie, or null if no such comment has been defined.

106.What is the use of setSecure() and getSecure() in Cookies ?

setSecure:Indicates to the user agent that the cookie should only be sent using a secure protocol (https).
This should only be set when the cookie's originating server used a secure protocol to set the cookie's value.
public void setSecure(boolean flag)
getSecure:Returns the value of the 'secure' flag.
public boolean getSecure()

107.What is meant by Httpsession and what is the use of sessions ?

The HttpSession interface is implemented by services to provide an association between an HTTP client and HTTP server. This session, persists over multiple connections and/or requests during a given time period. Sessions are used to maintain state and user identity across multiple
page requests.HttpSession session = req.getSession(true);

108.What is Servlet Context?

This object represents resources shared by a group of servlets like servlet's environment,
Application attributes shared in the context level.

109.How do you trap the debug the errors in servlets.

error log file

110.What are the different servers available for developing and deploying Servlets?
a) JRun2.0--Allaire
b) Apache --jserv
c) jwsdk2.0 --sun
d) servletexec
Visit http://www.downloadmela.com/ for more papers
e) Tomcat webserver--tomcat
f)Weblogic AS--BEA Systems
g)NetDynamics5.0--sun
h)Iplanet--sun&netscape
i)Netscape--netscape
g)IBM websphere--IBM
h)oracle--oracle
i)Proton-Pramati technologies

111.How do u implement threads in servlet?
Intenally implemented

112.How do you handle DataBase access and in which method of the servlet do you like to create connection.

init()

113.If you want to improve the performance how do you create connections for multiple users?

Connection Pooling.

114.what is connection pooling?
Class which manages no of user requests for connections to improve the performance.

115.How do you debug the Servlet?

through servlet log();



-------------------------------------
Also Read:






































 

1 comments:

Post a Comment