Error in includign jspf

拟墨画扇 提交于 2019-12-09 07:11:27

问题


I want to make include jspf into index jsp page , these statements

<%-- any content can be specified here e.g.: --%>
<%@ page pageEncoding="UTF-8" %>

aappears in the index page !!

here's the include line in index page

 <jsp:include page="WEB-INF/jspf/Header.jspf" />

Note : I make head and body in the index page only, can some body tell me why the first lines appears in the index page?


回答1:


JSPF files are intented to be statically included by @include. Its source code becomes then literally part of the parent JSP file. This happens only once, during compiletime.

<%@include file="/WEB-INF/jspf/Header.jspf" %>

If you want a compiletime include with <jsp:include> then just rename .jspf to .jsp. The source code will then be compiled once separately and its output will be generated and included during runtime. This happens then on every request.



来源:https://stackoverflow.com/questions/5874250/error-in-includign-jspf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!