Results 1 to 6 of 6
- 04-08-2008, 08:08 AM #1
<jsp:include> Vs <%@include> Vs <jsp:forward> Vs RequestDispatcher .forward/includeVs
Hi there,
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........
Regards
- 04-08-2008, 09:13 AM #2
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
- 04-09-2008, 08: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.....
regards
- 04-09-2008, 09:19 AM #4
Member
- Join Date
- Apr 2008
- Posts
- 91
- Rep Power
- 0
Hei,
<%@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
Action <jsp:include>
And
Pages Which Change Infrequently, Use The Include Directive.
- 07-29-2008, 01:54 PM #5
Member
- Join Date
- Jul 2008
- Posts
- 2
- Rep Power
- 0
Hi
As per my knowledge
<jsp:include page="/index.html" /> allow all kind of html and images and text files in pages
where as
<%@include allows only jsp pages.
correct me if i am wrong..................i have confusion on this.
- 07-29-2008, 02:13 PM #6
Similar Threads
-
Include file from other proyect
By oleg_gunnar in forum Advanced JavaReplies: 1Last Post: 03-08-2008, 06:20 PM -
Include Java file in HTML Page
By kathyc in forum New To JavaReplies: 2Last Post: 03-07-2008, 03:51 AM -
jsp:forward action
By Java Tip in forum Java TipReplies: 0Last Post: 12-24-2007, 10:04 AM -
jsp:include and include file
By Heather in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 07-14-2007, 04:19 PM


LinkBack URL
About LinkBacks

Bookmarks