GeekInterview.com
Series: Subject: Topic:

Servlets Interview Questions

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

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?

What is difference between servlet and applet

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

I don t know

Answered by: vishal sharma on: Oct 27th, 2012

Hello sir, Everywhere I read that Servlet does not work on GUI but applet works. What is meaning of this line?

Answered by: vinay on: Sep 29th, 2011

An applet get downloaded onto the client system and executes over the client system and gives the results..where as a servlet gets executed in a server and only the results are sent to the client.

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

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: 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.

Answered by: webdynamics on: Oct 31st, 2011

Yes, you can write a constructor in your Servlet if required. But you must understand how the sequence of flows. 1. Servlet instance is created i.e. constructor is called. Note: ServletConfig is not ...

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: shivaniyadav on: Jul 28th, 2012

they both r service methods.....

do get() has a disadvantage of sending very less amt of
information as it can send 24 to 255 character........

do post() is used for posting d information.....

Answered by: rpd on: Jul 19th, 2012

in doPost() data of the client is send as apart of request body and in doGet() data of the client is send as a part of url

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: 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?????

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

Yes we can override the service method in our servlet class. If we override the service method then we lose the functionality provided by the httpServlet class and doXXX() methods will not be called ...

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 difference between cgi and servlet in interview point?

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

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...

Answered by: siva kumar reddy on: Jul 31st, 2006

CGI and Servlets are used to develop web application only. CGI is a oldest technique and the main drawback of CGI is
1. Starting process is very expensive
2. It performs very poor.

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: Satendra Mishra on: Jan 30th, 2012

Only one instance create remain are composite object

Answered by: Dayanand Chowdhary on: Jul 30th, 2011

when the request comes from the same client/browser for the 100 times the existing Servlet Object is retrieved i.e if at all the request comes from the same browser/client new Servlet Object is not cr...

In which conditions we have to use the servletcontext

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

Answered by: Gita on: Jan 28th, 2012

http://tomcat.apache.org/tomcat-4.1-doc/servletapi/javax/servlet/ServletContext.html go through this link u will find setAttribute() method.

Answered by: jimmy514in on: Jul 3rd, 2010

Do we have setAttribute for ServletContext object...??

I couldn't find the method name in the API...

How many ways we can destroy the servlet in ur program

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

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.

Answered by: hirags on: Jul 17th, 2007

Guys pls refer these ... Please ensure your answer is not  mislead some body..http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/Servlet.htmlpublic void destroy()Called by the servlet co...

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: pradeep on: Jan 19th, 2012

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

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: 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.

Answered by: gayathri on: Nov 30th, 2011

Genericservlet is protocol independent, httpservlet is protocol dependent

Genericservlet contains p v service(-,-),
httpservlet contains p v service(-,-), protected v service(-,-), doGet(-,), doPost(-,-), doPut(-,-),--------etc

httpservlet is one of the predefined subclass of genericservlet

What is the modifier for the httpservlet class service method?

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

Protected.

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, ...

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

We have two service methods in httpServlet Dispatches client requests to the protected service method. Theres no need to override this method. public void service(ServletRequest req, ServletResponse...

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

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

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

Answered by: Rajkumar on: Nov 8th, 2006

When we make a request to the application webcontainer makes the request and response object and creates the servlet instance.After it calls the servlet life cycles methods like init().After completin...

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

Forward & include methods

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

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

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...

Answered by: javaguru1979 on: Jun 30th, 2008

Both forward() and include() are concrete methods of the RequestDispatcher class in the Servlet context. forward() - this method is used to show a different resource in place of the servlet originally...

How many servlet objects are created if we have 10 servlets in web application?

Asked By: cvachandu | Asked On: Jun 10th, 2011

Answered by: fathima on: Dec 20th, 2011

No.. for each servlet one instance is created.

ThreadPool ---> Servlet instace
Thread1 -----> servlet1
Thread2 servlet2
Thread3 servlet3

As per client request thread1,2,3 can access same servlet1 instance.We need instace for each servlet to access it.

Answered by: kumar on: Sep 8th, 2011

Only one object is created but for 10 servlets web container creates 10 threads

Servlet container

Asked By: gopalraop | Asked On: Apr 14th, 2008

What is difference between servlet container and servlet config?

Answered by: delindia on: Dec 20th, 2011

A servlet config object is used by a servlet container, to pass information to a servlet during initialization. The webserver uses separate module to load and run the servlets called servlet containe...

Answered by: srini235 on: May 20th, 2008

servlet container is part of web server which provides run time environment for servlets i.e it manages the entaire life cycle for the servlets like it creates instance,initialization,processing and destroying it.  

First | Prev | | Next | Last Page

 

 

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Ads

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.