Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JSTL导入标记抛出具有相对URL的java.lang.IllegalStateException_Java_Jsp_Jboss_Jstl_Stripes - Fatal编程技术网

JSTL导入标记抛出具有相对URL的java.lang.IllegalStateException

JSTL导入标记抛出具有相对URL的java.lang.IllegalStateException,java,jsp,jboss,jstl,stripes,Java,Jsp,Jboss,Jstl,Stripes,在Java web应用程序中,我使用Jboss 4.2.3上的Stripes框架。当我使用 <c:import url="http://localhost:8080/contextPath/txts/someID" charEncoding="UTF-8"/> 如有任何建议,将不胜感激 问题不在JSTL中,而是在目标servlet中。异常消息很清楚-您不应该为相同的响应调用getOutputStream()和getWriter()。问题不在JSTL中,而是在目标servlet中。异

在Java web应用程序中,我使用Jboss 4.2.3上的Stripes框架。当我使用

<c:import url="http://localhost:8080/contextPath/txts/someID" charEncoding="UTF-8"/>
如有任何建议,将不胜感激


问题不在JSTL中,而是在目标servlet中。异常消息很清楚-您不应该为相同的响应调用
getOutputStream()
getWriter()

问题不在JSTL中,而是在目标servlet中。异常消息很清楚-您不应该为相同的响应调用
getOutputStream()
getWriter()

问题是,如果使用读卡器打开StreamingResolution,那么它(自然)会打开一个Writer以流式输出。c:import标记并不重要,只是在响应上调用getOutputStream

因此,为了缓解这种情况,您不应该在StreamingSolution中使用读卡器,而是需要使用InputStream创建StreamingSolution

另一个选项是重写streamingsolution.stream()方法

条纹基本上是为你“做正确的事情”,但是c:导入正在你的游行队伍中雨点般地落下


谢天谢地,你可以控制你的行动。与c:imports操作不同。

问题在于,如果StreamingResolution是用读卡器打开的,那么它(自然)会打开一个Writer以流式输出。c:import标记并不重要,只是在响应上调用getOutputStream

因此,为了缓解这种情况,您不应该在StreamingSolution中使用读卡器,而是需要使用InputStream创建StreamingSolution

另一个选项是重写streamingsolution.stream()方法

条纹基本上是为你“做正确的事情”,但是c:导入正在你的游行队伍中雨点般地落下


谢天谢地,你可以控制你的行动。c:imports操作没有那么多。

根据规范,不应包括/contextPath,除非它与当前的不同。复制servlet代码以查看根据规范,不应包括/contextPath,除非它与当前的不同。复制servlet代码以查看我正在使用的目标servlet使用第二个构造函数(我在其中提供了一个InputStream)以条带形式传输内容的标准机制。这可能是该机制工作方式中的一个缺陷吗?在目标servlet上,我使用一个标准机制,使用第二个构造函数(我提供了一个InputStream)以条带形式流式传输内容。这可能是该机制工作方式中的一个缺陷吗?我正在使用提供InputStream的构造函数。我是否应该用response.getOutputStream().write(…)替代StreamingResolution.stream()?我使用的是提供InputStream的构造函数。我是否应该改为使用response.getOutputStream().write(…)覆盖StreamingResolution.stream()?
<c:import url="/txts/someID" charEncoding="UTF-8"/>
java.lang.IllegalStateException: Unexpected internal error during &lt;import&gt: Target servlet called getOutputStream(), then getWriter()
at org.apache.taglibs.standard.tag.common.core.ImportSupport$ImportResponseWrapper.getOutputStream(ImportSupport.java:492)
at net.sourceforge.stripes.action.StreamingResolution.stream(StreamingResolution.java:443)
at net.sourceforge.stripes.action.StreamingResolution.execute(StreamingResolution.java:240)
at net.sourceforge.stripes.controller.DispatcherHelper$7.intercept(DispatcherHelper.java:508)
at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:158)
at org.stripesstuff.plugin.security.SecurityInterceptor.interceptResolutionExecution(SecurityInterceptor.java:225)
at org.stripesstuff.plugin.security.SecurityInterceptor.intercept(SecurityInterceptor.java:129)
at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
at net.sourceforge.stripes.controller.HttpCacheInterceptor.intercept(HttpCacheInterceptor.java:99)
at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
at net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:113)
at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
at net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:74)
at net.sourceforge.stripes.controller.DispatcherHelper.executeResolution(DispatcherHelper.java:502)
at net.sourceforge.stripes.controller.DispatcherServlet.executeResolution(DispatcherServlet.java:286)
at net.sourceforge.stripes.controller.DispatcherServlet.service(DispatcherServlet.java:170)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)