Results 1 to 6 of 6
- 04-08-2008, 09:08 AM #1
<jsp:include> Vs <%@include> Vs <jsp:forward> Vs RequestDispatcher .forward/includeVs
can anyone give a clear answer for my below question.........
what is the difference between the bwlow,
<jsp:include> Vs <%@include> Vs <jsp:forward> Vs RequestDispatcher .forward/includeVs response.sendRedirect()..........
any answers really appricated........
- 04-08-2008, 10:13 AM #2
<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.
- 04-09-2008, 09:58 AM #3
yeah thanks sanjeev...
i always use only and <jsp:include> sendRedirect... May be from now i ll use the other..... However am confused wen to use what.... N'way thanks for relplying man.....
- 04-09-2008, 10:19 AM #4Member
- Join Date
- Apr 2008
- Rep Power
<%@include> The Include Directive includes The contents( jsp
pages ) statically. You Can Pass Some Data With This Mechanism,
Since The Code Is Appended In The Including Page.
<jsp:include> The Include Action includes The Response Or OutPut Of
The Page Dynamically.
So The Pages Which Changes frequently, Include With The Include
Pages Which Change Infrequently, Use The Include Directive.
- 07-29-2008, 02:54 PM #5Member
- Join Date
- Jul 2008
- Rep Power
As per my knowledge
<jsp:include page="/index.html" /> allow all kind of html and images and text files in pages
<%@include allows only jsp pages.
correct me if i am wrong..................i have confusion on this.
- 07-29-2008, 03:13 PM #6
- By oleg_gunnar in forum Advanced JavaReplies: 1Last Post: 03-08-2008, 07:20 PM
- By kathyc in forum New To JavaReplies: 2Last Post: 03-07-2008, 04:51 AM
- By Java Tip in forum Java TipReplies: 0Last Post: 12-24-2007, 11:04 AM
- By Heather in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 07-14-2007, 05:19 PM