{ City } bangalore
< Country > india
* Profession * software engineer
User No # 1762
Total Questions Posted # 0
Total Answers Posted # 16

Total Answers Posted for My Questions # 0
Total Views for My Questions # 0

Users Marked my Answers as Correct # 509
Users Marked my Answers as Wrong # 60
Questions / { tulasivani }
Questions Answers Category Views Company eMail

Answers / { tulasivani }

Question { 14671 }

How two servlets communicate with each other?


Servlets communicate with each other with the help of
RequestDispatcher objects.

RequestDispatcher rd=getServletConfig().getNamedDispatcher

... name used to identify a servlet i.e. name given in the
web.xml in the url-pattern

Is This Answer Correct ?    17 Yes 1 No

Question { 5888 }

Is there any need to shutdown the web server, if you want
to modify a servlet?


Yes, its essential to shutdown the web server if we have
made any modification to the servlet.The servlet contains a
text file and a classfile, if a modification is made to the
text file it will not be reflected in the classfile which
is used.Thus, the previous file i.e. before modification
will be stored in the server and it will not reflect the

Is This Answer Correct ?    1 Yes 0 No

Question { iFlex, 5604 }

Can a servlet be called by passing its name as a parameter
in the URL?


No, it cannot be done.We use deployment descriptors as
writtne in web.xml file which is used to identify a servlet.
servlet name, servlet class and url-pattern are specified
in the web.xml file which will find the url-pattern and
identify the servlet associated with in

Is This Answer Correct ?    8 Yes 2 No

Question { 6295 }

What are cookies and how will you use them?


Cookies are small bit of textual information that are sent
from the webserver to the browser and sent back from the
browser to the server without changing the data later.

Cookies are helpful during e-commerce sessions when it will
be possible to recoginise a user during a session or it
helps in advertising as we can know the user preferences.

Cookies are created using:

Cookie c=new Cookie("name",value);

you can retrive the cookie value using:

request.getCookie() which returns a String giving the name
of the cookie and the value associated with the cookie.

Is This Answer Correct ?    3 Yes 0 No

Question { Amplify Mindware, 11524 }

What are the exceptions thrown by Servlets?


The Expceptions thrown by the servlet can be in two
exception classes

1.Servlet Exception

public ServletException();
public ServletException(String message);
public Throwable getRootCause()

2.Servlet Unavailable Exception

public class UnavailableException extends ServletException

public UnavailableException(String message);
public UnavailableException(String message, int seconds);

Is This Answer Correct ?    11 Yes 3 No

Question { 45957 }

What are different types of Servlets?


The different types of servlets are

Generic Servlets
Http Servlets

Is This Answer Correct ?    173 Yes 11 No

Question { 9320 }

What are different types of SessionTracking?


The different types of sessiontracking are
1.HiddenForm Field
2.URL Rewriting

Is This Answer Correct ?    7 Yes 0 No

Question { Google, 13140 }

What is the ServletConfig() and what is its use?


ServletConfig gives the information regarding the
configuration of the servlet.It provides the information
regarding the initialisation parameters which are specified
in the web.xml file.Its also contains an object of servlet
context which gives servlet information about the container

Is This Answer Correct ?    32 Yes 3 No

Question { 5575 }

When the methods init() and Distroy() will be called?


The servlet life cycle included init() and destroy()(Small

init() is called at the beginning of the servlet,it
performs certain one time activities which are required
during the lifetime of the servlet.It may be some
initialisation of variables or a database connection.

destroy() is called to destroy the servlet.Various
resources which are held by the servlet will be
released,database connections which were opened will be
closed.Later the servlet is destroyed.

Is This Answer Correct ?    4 Yes 0 No

Question { 36347 }

what are the disadvantages of cookies?


The major disadvantage of cookies along with the 1st answer
is that its a major security threat.

The cookies are enabled and if any other user tries to
access the cookies he can easily view what the previous
user had accessed.If its some sensitive data, it can be a
major security threat

Is This Answer Correct ?    62 Yes 14 No

Question { InfoVista, 61471 }

How to make servlet thread safe?


There are two different ways of making a servlet thread
safe namely

1.By implementing SingleThreadModel.

By implementing a SingleThreadModel it will be possible to
create a Thread safe servlet.There can only be one user at
a given point of time.

2.Synchornize the part of sensitive code.

We can allow a single user at a given point of time by
making that part of the code which is sensitive as

Is This Answer Correct ?    127 Yes 6 No

Question { 7270 }

Difference between overloading and overridding?


Overloading is the concept where there are many methods
with the same name in a class but the arguments passed
differ.Consider the example of method called
addition.Addition can be between integers,floating point
numbers etc., so same name addition is used for the various
methods of class but the parameters passed differ, it may
be integer or floating point.When the jvm checks for the
methods, the method is choosen depending upon the argument

Overriding is the concept where the method name is
same,arguments passed are also same and the return type is
also same.but the method implemented depends upon where its
defined and called

Is This Answer Correct ?    13 Yes 1 No

Question { Wipro, 18379 }

what is an object and how do you allocate memory to it?


Object is an instance of the class.There are two ways by
which a new object is created.

1.using new operator.
classname objectname=new classname;
This allocates the memory to objectname.

This can be classname objectname by which null values are
set to the objectname and not the values as in the class.

2.without using new operator.
Declare the variables as static and also methods used as
static and by using the keyword static we can create an
instance of the class.
Thus, we use public static void main(String args[])in main
program where theres no need to create a class and also
instance of class using new operator.

Is This Answer Correct ?    8 Yes 3 No

Question { Siemens, 13917 }

What is servlet?


Servlets are server side java programs that are run on web
or application servers.They act as a middle layer between
the requests coming from the web browsers and databases

Is This Answer Correct ?    8 Yes 1 No

Question { 6243 }

How to deal with multi-valued parameters in a servlet?


To get the multi-valued parameters in servlet we can use
request.getParameterValues() which returns an array of
values which are associated with it.

Use an Enumeration to store the values.It has two methods
namely hasMoreElements()which is used in a while loop
which executes unitl it finds another element in the
enumeration and hasNext()which is again used in a while
loop and executes until it has a nextElement and retrives
the required data.

Is This Answer Correct ?    1 Yes 0 No

 [1]   2    Next