Series: Subject: Topic:

Servlets Interview Questions

Showing Questions 1 - 20 of 177 Questions
First | Prev | | Next | Last Page
Sort by: 

What is difference between servlet and applet

Asked By: Nilesh | Asked On: Sep 17th, 2005

I don t know

Answered by: Gopi Devarapalli on: Sep 11th, 2014

Applet is web application that runs on browser. where as servlet webapplicaton that runs on server which can be accessed.

Answered by: sujata waghmare on: Jan 10th, 2014

Different between servlet and applet ...because servlet is run on web server.applet is run on browser..

What is the difference between doget() and dopost() methods of a httpservlet and when to use each one?

Asked By: rs | Asked On: Nov 6th, 2006

Answered by: Gopi Devarapalli on: Sep 11th, 2014

The doGet() attach result to URL. where as doPost it will not show result on the URL. It is internally attaches to next resources.

Answered by: sandy on: Jul 17th, 2014

if we override either lifecycle or non-lifecycle service method, then our servlet class loses the logic given by the super class but if we override doGet() or doPost() method of super class , then our...

What is the difference between genericservlet and httpservlet?

Asked By: Interview Candidate | Asked On: May 28th, 2005

Genericservlet is for servlets that might not use http, like for instance ftp service.As of only http is implemented completely in httpservlet. The genericservlet has a service() method that gets called when a client request is made. This means that it gets called by both incoming requests and the http...

Answered by: SUJATA WAGHMARE on: Jan 10th, 2014

I think..genericserlvet handly any type of request..and httpservlet handly only http request this is different between genericservlet and httpservlet like..doget,dopost,dotrace()..theses are method of httpservlet class...both are classes

Answered by: ajaykumargurrala on: Jan 11th, 2012

GenericServlet suppports only service(). It handles simple requests, It is platform-independent. It handles all types of protocols like http, smtp, ftp.

HttpServlet supports both doget() & dopost(). It supports state programming also. It is platform-dependent. It handles only Http protocol.

Servlet is Java class. Then why there is no constructor in servlet ?  can we write the constructor in servlet

Asked By: Interview Candidate | Asked On: Sep 8th, 2005

Answered by: sujata waghmare on: Jan 10th, 2014

Yes..we can write a constructor in servlet...most important things is init() only inilization ....but constructor perform operation thats why we can write a constructor in servlet...

Answered by: Rohit on: Jul 30th, 2012

Do get is like a open store, let come take what you want...but match the address....then
dopost is posting the all data to where is a address like all information in one box.

In which conditions we have to use the servletcontext

Asked By: kailash | Asked On: Oct 11th, 2005

Answered by: sujata waghmare on: Jan 10th, 2014

we can use servletcontext it condition whole application only one object...dont change a servlet...only change a web.xml object use to whole application that situation use a servletcontext....

Answered by: Gita on: Jan 28th, 2012

Http:// go through this link u will find setAttribute() method.

How many ways we can destroy the servlet in ur program

Asked By: nagaraj | Asked On: Feb 3rd, 2006

Answered by: sujata waghmare on: Jan 10th, 2014

I think..only one time ...only used to destroy()..

Answered by: mallikarjun on: Jan 23rd, 2012

We can destroy servlet in two ways one is when the server time out and another one is when power off.

What is difference between cgi and servlet in interview point?

Asked By: venkata narayana | Asked On: Mar 8th, 2006

Answered by: SUJATA WAGHMARE on: Jan 10th, 2014

Before servlet used to technology cgi....but cgi have a drawback...cgi throw send requests to web server..then web server make process for one request...thats why processor not response to the client.....servlet is share comman memory area...this is different between servlet and cgi...

Answered by: Amit Udiya on: Feb 27th, 2012

Each time whenever a request comes to a CGI from server,it opens a new connection for that request.If a number of clients make request to the same serve,CGI will open a new connection to serve their r...

What is the diff b/w doget() and service() method

Asked By: ram | Asked On: Aug 6th, 2006

Answered by: SUJATA WAGHMARE on: Jan 10th, 2014

Doget() accept http type of request form protected seveices()...send data to url throw..meas limited method used to genericservlet class and only accept servletrequest nad servletrespons accept http type request....

Answered by: delindia Fathima on: Dec 22nd, 2011

Service method orginates from Generic Servlet and so service method is used to do something which does not involve http protocol.

service handles standard HTTP requests by dispatching them to the handler methods(doXXX) for each HTTP request type

What is the modifier for the httpservlet class service method?

Asked By: sujatham | Asked On: Aug 8th, 2007


Answered by: SUJATA WAGHMARE on: Jan 10th, 2014

I think..protected void services(httpservletrequest request,httpservletresponse response)throw ioexcpetion , servletexception...this is modifier for httpservlet class service method...

Answered by: delindia fathima on: Dec 22nd, 2011

Sorry i was not clear with my previous answer.So posting answer again We have two service methods in httpServlet public void service(ServletRequest req, ServletResponse res) throws ServletException, ...

What is the difference between doget methods,doget()and service() used in servlet?Can we use service() methods replace of doget() and dopost()?

Asked By: ajay | Asked On: Aug 22nd, 2007

Answered by: sujata waghmare on: Jan 10th, 2014

yes..but our functionality may be loss..that why web continer... calling services() then services two type.first one is public service() and second one protected services()...public services meth...

Answered by: kishore on: May 9th, 2012

OK,but my question is... In HttpServlet class service method calls doGet() or doPost() method .Intead of overriding doGet() or doPost(),why should we not override service() method itself?????

Forward & include methods

Asked By: RajeshKumar.Guru | Asked On: May 13th, 2008

What are forward & include methods? Why these are used?

Answered by: SUJATA WAGHMARE on: Jan 10th, 2014

1 ]forward method :client send request first servlet and first servlet forward the request second servlet most important things is second servlet give a response to clinet.... 2]include method:clinet...

Answered by: delindia fathima on: Dec 20th, 2011

The RequestDispatcher include() method inserts the the contents of the specified resource directly in the flow of the servlet response, as if it were part of the calling servlet. The RequestDispatch...

Is servlets thread-safe?

Asked By: Mukeshtop | Asked On: Dec 21st, 2011

Service() method of servlet class is not synchronize then how will it work as thread-safe for every request at the same time?

Answered by: sujata waghmare on: Jan 10th, 2014

Servlets thread safe..servlet and jsp both are multithreaed thats why control the flow ...

Answered by: pradeep on: Jan 19th, 2012

Servlets are not thread safe. If you want to make it Servlet as Thread safe, you can implement SingleThreadInterface

Why genericservlet is an abstract class ?

Asked By: Saurabh | Asked On: Dec 12th, 2006

Answered by: Balakrishna on: Aug 21st, 2013

GenericServlet class implements all methods of Servlet interface except service() method.
If any class cant implements all methods of the interface,that class before we declare a "abstract" keyword and that class becoming an abstract class

Answered by: Avijit Chowdhury on: Nov 10th, 2011

When you are overriding any abstract class, you have to override all the methods of that class.

How many objects are created when same or different client send 100 requests to a servlet?

Asked By: sadashivarao | Asked On: Sep 13th, 2006

Answered by: kesav chari on: Jun 28th, 2013

Only one ServletObject is Created , even multiple clients sends the request to server . Because that servlet object is removed when the Project is undeployed from the server or when stop the server

Answered by: Satendra Mishra on: Jan 30th, 2012

Only one instance create remain are composite object

Consider a scenario in which 4 users are accessing a servlet instance. Among which one user called destroy() method. What happens to the rest 3 users?

Asked By: Sohamsri | Asked On: Nov 21st, 2005

Answered by: Janga Yella Raju on: May 25th, 2013

Calling destroy method by himself. Doesnt means destroying the servlet. Container will take care to destroy the servlet when application undeployed or system shut downs. So, if 1 user calls destroy m...

Answered by: sampra on: Mar 4th, 2008

If there are 4 user and one has distroy the thred then thread which he is using only that will be distroy rest will be keep alive

Variable declaration...

Asked By: VishalSudarshan | Asked On: Mar 20th, 2013

How we can declare the variable, which we can access through-out the session in servlet & JSP?

Applet trusted or not

Asked By: koti143 | Asked On: Sep 6th, 2012

By default applets are trusted or untrusted? is it possible to connect with database using applet program using type1 driver?

Answered by: Murali100 on: Oct 7th, 2012

Applets are trusted.But we can use Type 3 Driver & Type 4 driver to connect the database

Why do we need to implement 3rd party support for using connection pooling ?

Asked By: JavaPassion | Asked On: Aug 12th, 2007

Answered by: sangram on: Mar 31st, 2012

It will provide better service

What is the difference betweem getrequestdispatcher() available as part of servletcontext and servletrequest

Asked By: divya_a | Asked On: Feb 22nd, 2006

Answered by: Delindia fathima on: Dec 20th, 2011

requestDispatcher() of a servlet context will takes absolute path Whereas requestDispatcher() of ServletRequest will takes relative path ServletRequest has current request path to evaluate the relati...

Answered by: Ambar Ray on: Sep 4th, 2011

Hey Folks, In my above post, I missed adding this line which is the MOST IMP change above all one has to make in Tomcat's context.xml file in order to make the above code snipet work-- {geshibot langu...

Struts security

Asked By: s_narasimharao | Asked On: Nov 16th, 2010

How will you provide security to web application?

Answered by: Delindia Fathima on: Dec 20th, 2011

Servlet provides below security options to web applications 1. Providing Authentication - username/password 2. Providing Authorization - whether user has right access to requested resource. Like doc...

Answered by: varun on: Aug 19th, 2011

Using POST method we can provide security

First | Prev | | Next | Last Page





twitter fb Linkedin GPlus RSS


Interview Question

 Ask Interview Question?


Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.