包含jspf时出错 [英] Error in includign jspf

查看:98
本文介绍了包含jspf时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将jspf包含到索引jsp页面中,这些语句

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?

推荐答案

JSPF文件打算静态包含在 @include 。它的源代码就成了父JSP文件的一部分。这只在编译期间发生一次。

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" %>

如果您希望编译时包含< jsp:include> 然后只需将 .jspf 重命名为 .jsp 。然后,源代码将单独编译一次,并在运行时生成并包含其输出。然后在每次请求时都会发生这种情况。

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.

这篇关于包含jspf时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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