This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JSP and the fly likes which include to use page or file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "which include to use page or file" Watch "which include to use page or file" New topic
Author

which include to use page or file

mary morris
Ranch Hand

Joined: Mar 16, 2002
Posts: 97
Which of the below is better to use on a web site.
I would have 3 includes on each page,- and would be the same for each page. ie. a header, footer, and left nav.
<%@ include file="this.jsp"%>
<jsp:include page="that.jsp" flush="true"/>
Is the below correct?
<jsp:include /> tag which is processed at runtime,
and <%@ include %> tag which is prcessed at compile time...
when is it better to use one or the other??
Thanks
Trish Wu
Ranch Hand

Joined: Oct 09, 2002
Posts: 34
If you are only including the header, footer and navigation bar which are only static content. I would say to use static inclusion.
Just remember the rules that there are more dependencies if u share variables among the pages (i.e. they cant be compiled individually, only if u make use of pageContext to share variables). Also it is only suitable for parts which do not change very often.
Another pointer
Other discussion
mary morris
Ranch Hand

Joined: Mar 16, 2002
Posts: 97
Thanks for your reply and to directing me to the other forum question on the includes.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: which include to use page or file