include?

fuyou001 2008-04-04 01:04:48
banner.jsp
<body>
<img src="logo.bmp">
<hr>


bookdetails.jsp
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>BookDetails</title>
</head>
<%@ include file="banner.jsp" %>
<br>

</body> <!--这里有错 -->
</html>

这个bookdetails.jsp有错!
...全文
93 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
scorpionqxq 2008-04-04
  • 打赏
  • 举报
回复
所以我认为 include 文件里别写 <head> 或 <body> 之类的标签,以免主页面总少了些东西
或者 用 <jsp:include> 标签
  • 打赏
  • 举报
回复
按理说是不会有问题的 事实上也没问题 哈哈
试了一下 用eclipse没玩起来 把代码考到记事本里倒是可以
翻译出来的源码

public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {

PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
PageContext _jspx_page_context = null;


try {
response.setContentType("text/html; charset=gb2312");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
_jspx_page_context = pageContext;
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;

out.write("\r\n");
out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n");
out.write("<html>\r\n");
out.write("<head>\r\n");
out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\">\r\n");
out.write("<title>BookDetails</title>\r\n");
out.write("</head>\r\n");
out.write("<body>\r\n");
out.write("<img src=\"logo.bmp\">\r\n");
out.write("<hr>\r\n");
out.write("\r\n");
out.write("<br>\r\n");
out.write("\r\n");
out.write("</body> <!--这里有错 -->\r\n");
out.write("</html>");
} catch (Throwable t) {
dengyi132 2008-04-04
  • 打赏
  • 举报
回复
你<body>开始标记都没得。。。。
也可以这样<jsp:include refresh="true" page="banner.jsp"/>
zt_soft 2008-04-04
  • 打赏
  • 举报
回复


<c:import file = "banner.jsp"/>

前面引入c tag
kokobox 2008-04-04
  • 打赏
  • 举报
回复
<jsp:include page="banner.jsp"/>

然后把banner.jsp放到同级目录
awusoft 2008-04-04
  • 打赏
  • 举报
回复
你运行 没有呀?
nihuajie05 2008-04-04
  • 打赏
  • 举报
回复
...我昨天开始学的...不会
老紫竹 2008-04-04
  • 打赏
  • 举报
回复
include没用,呵呵! eclipse的 html 语法检查还是不好用
老紫竹 2008-04-04
  • 打赏
  • 举报
回复
没有body 啊!

81,115

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧