Vous êtes sur la page 1sur 5

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 14 answers

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... Answer Question Select Best Answer

In which conditions we have to use the servletcontext


Asked By: kailash | Asked On: Oct 11th, 2005 Answered by: Gita on: Jan 28th, 2012 11 answers

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... Answer Question Select Best Answer

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 Answered by: hirags on: Jul 17th, 2007 11 answers

We can destroy servlet in two ways one is when the server time out and another one is when power off. 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... Answer Question Select Best Answer

Is servlets thread-safe?
Asked By: Mukeshtop | Asked On: Dec 21st, 2011 1 answer

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 Answer Question Select Best Answer

What is the difference between genericservlet and httpservlet?


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

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(). ...
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... Answer Question Select Best Answer

What is the modifier for the httpservlet class service method?


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

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... Answer Question Select Best Answer

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 5 answers

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 han...
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... Answer Question Select Best Answer

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 14 answers

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... Answer Question Select Best Answer

Struts security
Asked By: s_narasimharao | Asked On: Nov 16th, 2010 3 answers

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 Answer Question Select Best Answer

Forward & include methods


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

2 answers

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... Answer Question Select Best Answer

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 4 answers

No.. for each servlet one instance is created. ThreadPool ---> Servlet instace Thread1 -----> servlet1 Thread2 servlet2 Thread3 servlet3 As per client request thread1,2,3...
Answered by: kumar on: Sep 8th, 2011

Only one object is created but for 10 servlets web container creates 10 threads Answer Question Select Best Answer

Servlet container
Asked By: gopalraop | Asked On: Apr 14th, 2008 3 answers

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,proces... Answer Question Select Best Answer

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: Delindia Fathima on: Dec 20th, 2011 12 answers

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 ...
Answered by: jitendrab31 on: Sep 11th, 2009

We must override either doget or do post but we should not override the service method and leave this on HTTPservlet. Answer Question Select Best Answer

How to get one servlet's context information in another servlet?


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

Access or load the servlet from the servlet context and access the context information
Answered by: Suresh Yerra on: Dec 11th, 2011 Answered by: bharathwatch on: Jul 9th, 2011

We can get the Servlet Context informaiton by using getNamedDispatcher() method in ServletContext. By using ServletContext object... Answer Question Select Best Answer

Write a Java servlet to read two parameters ?


Asked By: Rakesh | Asked On: Nov 5th, 2011 1 answer

Write a Java servlet which reads two parameters from the web page,say,value 1 and value 2,which are of type integers,and finds the sum of the two values and return back the result as a web page
Answered by: kamal Mehta on: Dec 11th, 2011

String value1=request.getParameter("value 1"); String value2=request.getParameter("value 2"); Int sum; Int val1=Integer.parseInt("value1"); Int val2=Integer.parseInt("value2"); sum=val1+val2; resp... Answer Question Select Best Answer

Why genericservlet is an abstract class ?


Asked By: Saurabh | Asked On: Dec 12th, 2006 Answered by: Avijit Chowdhury on: Nov 10th, 2011 9 answers

when you are overriding any abstract class, you have to override all the methods of that class.
Answered by: dhruv_saksena on: Mar 14th, 2008

GenericServlet is an abstract class because its upto the user how he wants it to use the life-cycle methods of the servlet and also the server needs to make sure that all the life cycle methods of the... Answer Question Select Best Answer

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: webdynamics on: Oct 31st, 2011 13 answers

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 ...
Answered by: suraj20p on: Oct 28th, 2011

Servlet is a java class,whose object will be created by servlet container,and then container will call 3 life cycle method on that object. container creates our servlet class object using 0-args cons... Answer Question Select Best Answer

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: Ashok Kumar Gogula(MCA) on: Oct 15th, 2011 15 answers

A doGet() method is limited with 2k of data to be sent, and doPost() method doesn't have this limitation. A request string for doGet() looks like the following: http://www.allapplabs.com/svt1?p1=v1&p...
Answered by: papia on: Sep 24th, 2011

1) In doGet Method the parameters are appended to the URL and sent along with header information. In doPost, parameters are sent in separate line in the body 2) Maximum size of data that can be sent ... Answer Question Select Best Answer

What is the difference between servlets and applets?


Asked By: Interview Candidate | Asked On: Jun 30th, 2005 6 answers

Servlets are to servers. Applets are to browsers. Unlike applets, however, servlets have no graphical user interface.
Answered by: shubhra on: Sep 30th, 2011

Applet have no main method. It executes in browser but servlet is a server side program it executes in application server.
Answered by: jimmy514in on: Jul 3rd, 2010

But Servlet is a Server Side Component. It is a Controller in the MVC architecture, It is used to perform business logic and does not deal with the visual implementation. The visual part is done by us...

Vous aimerez peut-être aussi