<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="" %> 这是静态包含
如果你使用其中的一个标签出错的话,不妨换一个标签试试