Pls Clear my Following Doubts.. 1. When We use RequestDispatcher to redirect a request some other Page Which Method(GET Or POST Or Depend upon the previous Request)It will Use.... 2. Can We call Destroy method inside the Service Method in Servlet 3. What is the Difference Between redirectURL() and RequstDispatcher in redirecting the page
1. When We use RequestDispatcher to redirect a request some other Page Which Method(GET Or POST Or Depend upon the previous Request)It will Use....
answer to this is the thrid option.. it will be processed according to the original request sent by the client.
2. Can We call Destroy method inside the Service Method in Servlet
for this.. i don't think we can call destroy() inside service().. destroy is supposed to be called by the client...
3. What is the Difference Between redirectURL() and RequstDispatcher in redirecting the page
here i want to ask whther any method redirectURL() exists... if it exists then i am sorry i am not aware of it (please let me know in which class or interface does it exist!!).. what i know is there are two ways of redirecting the servlet.. 1. response.sendRedirect() 2. request.getRequestDispatcher().forward(request, response); the difference between two is that.. in first method.. the response is commited to client and then the client is forced to call the URL mentioned as the parameter.. but in second case.. the request is forwarded as it is came to another servlet .. so the extra round to client is saved.. but using the first method u can call any URL of another server, which is not possible in second case.. the RequestDispatcher has to have a relative or excat URL of same server on which the redirecting servlet resides. i think this should be clear... correct me if i am wrong... Thanks Amit
****************************<br />In 24 hrs Earth rotates once on its Axis.
Joined: Oct 10, 2003
oops .. i made a mistake in second question.. destroy is not called by client.. it is called by container... rest is same.. thanks Amit
Why does someone want to call destroy method inside service method? In this method the servlet should cleanup resources which is acquired in the earlier part of its lifecycle. Once this method is called by the container, the servlet instance will be out of service and the container will never call service method of that particular instance. I think there must be certain rule in calling this method. Any idea? -Sainudheen
The question about destroy() when will be invoked by the servlet container is really a question about servlet lifecyle. To understand invoking destroy() by the servlet container you have to know the conditions which a servlet will be destroyed. Refering SRV2.3 in servlet specification2.4 might give you some useful imformation. Condition 1: The servlet container is being shutdown. Condition 2: The servlet container wants to conserv memory resource. (These two are referenced @ SRV2.3.4) Condition 3: The service method throws a UnavailabelException, the servlet container must release the servlet with invoking destroy method. (In general, the exception should be 'permanent' type, I bet there are servlet container implementations did same work as permanent when a temorary is UnavailableException throwed). Condition 4: I think there might be some other cases will invoking destroy, that depends on the implementations of servlet container. Am i right? Corrects me, you have my appreciation.
life-cycle methods and the sequence in which they are called: 1. The servlet is constructed, then initialized with the init method. 2. Any calls from clients to the service method are handled. 3. The servlet is taken out of service, then destroyed with the destroy method, then garbage collected and finalized
It is impossible to make anything foolproof because fools are so ingenious..Murphy<br />Basu.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com