您的位置:首页 > Web前端 > JavaScript

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

2014-10-06 15:20 531 查看
<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="" %> 这是静态包含如果你使用其中的一个标签出错的话,不妨换一个标签试试
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息