include指令和< jsp:include>属性名称问题 [英] include directive and <jsp:include> attribute name problem

查看:78
本文介绍了include指令和< jsp:include>属性名称问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么在JSP中,我们在include指令中将属性名称写为 file ,但将其写为 page 标准动作?

Why in JSP we write attribute name as file in include directive, but as page standard action?

推荐答案

<% include file="target.jsp" %>会将target.jsp的源内联到您的页面中,然后将整个内容作为一个JSP进行评估.这是在JSP编译时完成的.容器可以对此进行高度优化,并可能产生副作用.例如,如果更改target.jsp的内容,则该容器通常不会重新编译包含它的JSP.

<% 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执行target.jsp,然后将该执行的输出包含到您的页面中.这是在JSP执行时完成的.请注意,这可以引用容器内的任何路径,而不仅仅是JSP(例如,您可以包括Servlet的输出).

<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).

这篇关于include指令和&lt; jsp:include&gt;属性名称问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆