jeudi 13 août 2015

JSP servlet include tuncated

I am trying to include the response from a servlet in a jsp page using:

<li><jsp:include page="/icr/TasksServlet.html"/></li>

The servlet gives back one word:

try (PrintWriter out = response.getWriter()) {
        out.println("OOps");
        out.flush();
        out.close();
    }

And the result is that my page is truncated directly after the "OOps"

    <ul class="navList">
    <li>ICR Open Tasks</li>
    <li>
        <ul>
    <li>OOps

The tomcat throws this error:

org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet 
[validateUser] in context with path [/CAS] threw exception
[java.lang.IllegalStateException: Exception occurred when flushing data]
with root cause
java.io.IOException: Stream closed

I have tried to add and remove the out.flush(); and out.close(); as well as added flush="true" to the jsp:include tag.

I running tomcat 8.0.24; Netbeans with spring MVC.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire