【疑难解答】JSP中使用include标签

来源:互联网 发布:mac系统怎么下载steam 编辑:程序博客网 时间:2024/06/11 06:54
<span style="font-family: arial, 'courier new', courier, 宋体, monospace; white-space: pre-wrap;">Servlet.service() for servlet [action] in context with path [/s] threw exception [java.lang.IllegalStateException: Exception occurred when flushing data] with root cause</span>
java.io.IOException: Stream closed
当出现这种错误时,
1:首先检查
页面跳转后有没有加入return;
2:被包含的页面不要有多余的标签
去掉被包含页面<html>,<head>
但是某些JSP标签可以留下
例如
<%@page import="com.utils.RefererUtils"%><%@ page language="java" contentType="text/html; charset=UTF-8"pageEncoding="UTF-8"%><%  if(RefererUtils.isReferer(request, response)){response.sendRedirect(request.getContextPath()+"/index.jsp");return;}%>

3.检查inclde标签是否用错

1.<jsp:include page="" /> 这是动态包含

2.<%@include file="" %> 这是静态包含
如果你使用其中的一个标签出错的话,不妨换一个标签试试
0 0
原创粉丝点击