1

Java Web アプリケーションでは、Jboss 4.2.3 で Stripes フレームワークを使用しています。私が使用するときの私のJSPで

<c:import url="http://localhost:8080/contextPath/txts/someID" charEncoding="UTF-8"/>

それはうまく機能し、コンテンツは出力 HTML に含まれます。ただし、これは機能しません

<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)

アドバイスをいただければ幸いです。

よろしく

4

2 に答える 2

3

The problem is that if the StreamingResolution is opened with a Reader, then it (naturally) opens a Writer to stream the output out. The c:import tag doesn't care, and simply calls getOutputStream on the response.

So, to mitigate this you should not use a Reader for your StreamingResolution, rather you need to create the StreamingResolution with a InputStream.

The other option is to override the StreamingResolution.stream() method.

Stripes is basically "doing the right thing" for you, but the c:import is raining on your parade.

Thankfully, you have control over Stripes actions. Not so much over c:imports actions.

于 2011-04-12T22:37:48.353 に答える
1

問題はJSTLではなく、ターゲットサーブレットにあります。例外メッセージは明確です-あなたは同じ応答をgetOutputStream()呼び出すべきではありません。getWriter()

于 2011-04-12T21:57:07.983 に答える