Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-08-2008, 09:08 AM
freddieMaize's Avatar
Member
 
Join Date: Apr 2008
Location: Bangalore,India
Posts: 46
freddieMaize is on a distinguished road
<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
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-08-2008, 10:13 AM
sanjeevtarar's Avatar
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

Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-09-2008, 09:58 AM
freddieMaize's Avatar
Member
 
Join Date: Apr 2008
Location: Bangalore,India
Posts: 46
freddieMaize is on a distinguished road
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
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-09-2008, 10:19 AM
Member
 
Join Date: Apr 2008
Posts: 91
javarishi is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Include file from other proyect oleg_gunnar Advanced Java 1 03-08-2008 07:20 PM
Include Java file in HTML Page kathyc New To Java 2 03-07-2008 04:51 AM
jsp:forward action Java Tip Java Tips 0 12-24-2007 11:04 AM
jsp:include and include file Heather JavaServer Pages (JSP) and JSTL 1 07-14-2007 05:19 PM


All times are GMT +3. The time now is 01:12 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org