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:[EMAIL PROTECTED] 
> Sent: Tuesday 07 December 2004 16:29
> To: [EMAIL PROTECTED]
> Subject: when to use <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to