View Single Post
  #2 (permalink)  
Old 04-08-2008, 10:13 AM
sanjeevtarar's Avatar
sanjeevtarar sanjeevtarar is offline
Senior Member
 
Join Date: Apr 2008
Location: Delhi(India)
Posts: 249
sanjeevtarar is on a distinguished road
Hello Dear..

<jsp:include> : to include pages at request time , JSP content cannot affect main page: only output of included JSP page is used
<%@include> : (the include directive) to include files at page translation time, To reuse JSP content in multiple pages, where JSP content affects main page


RequestDispatcher .forward/include : Is used when we want to forward request from server to server there is no client interaction.

response.sendRedirect() : In this case client is involved, first request is forwarded to client and then new request is generated from client side. In this case Header value is set by server to tell the client browser to generate new request.

When you invoke a forward request, the request is sent to another resource on the server, without the client being informed that a different resource is going to process the request. This process occurs completly with in the web container. When a sendRedirtect method is invoked, it causes the web container to return to the browser indicating that a new URL should be requested. Because the browser issues a completly new request any object that are stored as request attributes before the redirect occurs will be lost. This extra round trip a redirect is slower than forwa
It is good to user RequestDispatcher then sendRedirect.



sanjeev

Reply With Quote