日期:2014-05-16  浏览次数:20301 次

jsp 抛出 java.lang.IllegalStateException 错误
在调试一个jsp页面时出现了异常当我在代码中加了权限校验的标签<z:checkAuthority tranid="00000" />后出现异常

<%@ page import="com.faw_qm.erp.web.data.DataUtil" %>
<%@ page import="java.util.List" %>
<%@ taglib prefix="z" uri="/WEB-INF/cfg/merptag" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sd" uri="/struts-dojo-tags" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<s:head theme="xhtml"/>
<sd:head parseContent="true"/>

<head>
    <title>创建新用户</title>
</head>
<body>
<jsp:include page="/ui/common/title.jsp" flush="true"/>
<z:checkAuthority tranid="00000" />

 <h5>创建新用户</h5>
<%
    List dataList = DataUtil.queryCompany();
    dataList.add(0,"");
    application.setAttribute("compList", dataList);
%>
<s:form action="/login/createUser" method="post">
    <s:token/>
    <s:textfield label="用户名称" name="username"/>
    <s:password label="密码" name="password"/>
    <s:password label="确认密码" name="confim"/>
    <s:textfield label="电话" name="phone"/>
    <s:combobox label = "单位" list="%{#application.compList}" name="company" size="20"/>
    <s:submit value="提交"/>    
</s:form>
</body>
</html>


2010-11-26 15:52:26 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException
 at org.apache.catalina.connector.ResponseFacade.sendRedirect(ResponseFacade.java:435)
 at com.faw_qm.erp.web.tag.CheckAuthority.doStartTag(CheckAuthority.java:39)
 at org.apache.jsp.ui.common.adduser_jsp._jspx_meth_z_005fcheckAuthority_005f0(adduser_jsp.java:188)
 at org.apache.jsp.ui.common.adduser_jsp._jspService(adduser_jsp.java:109)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
 at java.lang.Thread.run(Thread.java:619)


找很久的原因,最后哈哈竟然因为 我在这个标签前用了<jsp:include page="/ui/common/title.jsp" flush="true"/> 这个标签flush="true",当我把他改为false 竟让通过了,原来这个相当于 out.flush ?!?