tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Kirk" <tomcat-u...@web-startup.co.uk>
Subject RE: when to use <%@include%> when to use <jsp:include>
Date Tue, 07 Dec 2004 18:52:23 GMT
Here's one perspective based on one way I have used them. there are others.

<%@ include%> is useful when you know the name of the page you want to
include at coding time.

<jsp:include> is useful when you do not know the name of the page you want
to include until execution time, because it can evaluate jsp expressions to
come up with the value of the page attribute. for example I use this code in
a generic page, which assembles a page on the fly according to params that
have been passed to the JSP from my servlet, allowing the same core page
data to be presented within any page layout that you choose.

<jsp:include page = "<%= "layout/" + pageLayoutName + "_begin.jsp" %>" />
<jsp:include page = "<%= jspPageName %>" />
<jsp:include page = "<%= "layout/" + pageLayoutName + "_end.jsp" %>" />

> -----Original Message-----
> From: Zerol Tib [mailto:zerol.tib@gmail.com] 
> Sent: Tuesday 07 December 2004 16:29
> To: tomcat-user@jakarta.apache.org
> Subject: when to use <%@include%> when to use <jsp:include>
> 
> 
> Howdy,
> 
> As we know, <%@ include%> can include another jsp page 
> at "translation time" while <jsp:include> can include another 
> jsp at "runtime". But when to use each? Could anyone give me
> a scenario?
> 
> Thanks in Advance.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message