Why in JSP we write attribute name as file in include directive, but as page standard action?
<% include file="target.jsp" %>
will inline the source of target.jsp
into your page, and then the whole thing will then be evaluated as a single JSP. This is done at JSP compile time. This can be highly optimized by the container, and can have side-effects. For example, if you change the content of target.jsp
, the container generally will not recompile the JSPs that included it.
<jsp:include page="target.jsp"/
> will execute target.jsp
as a seperate JSP, and then include the output of that execution into your page. This is done at JSP execution time. Note that this can refer to any path inside the container, not just a JSP (e.g. you can include the output of a servlet).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With