第1个回答 2013-08-08
jsp中include指令的作用:1,jsp向当前页面加入另一文件的方法:<jsp:include page=”relativefileURL” flush=”true”/>
2,是用来向当前页中插入一个静态文件的内容,这个文件可能是html文件、jsp文件或其它文本文件,格式如下:<%@ include file=”include.inc”%>如:native.jsp:<body>native file start here.<br><%@ include file=”include.inc”%>native file end here.<br></body>include.inc:include file start here.<br><%! String str=”Here is include’s context!”;%><% out.pringln(str+”<br>”);%>include file end here.<br>运行native.jsp,结果如下:native file start here.include file start here.Here is include’s context!include file end here.native file end here.注意:因为include.inc文件是在编译时才插入的,所以只改 include.inc文件内容,而不对原JSP页面做修改,得到的结果仍将是以前的结果。(因为一开始JSP引擎就判断了JSP页面没被改动过,就直接执行已存在的字节码,而不对源代码重新编译,这样对include做的修改也就在这没有反映。)