tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Remy Maucherat" <>
Subject Re: IllegalStateException on jsp:include in simple jsp page
Date Sun, 30 Sep 2001 17:42:26 GMT
> This simple tst.jsp page:
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <html>
> <head>
>  <title>Tst.jsp</title>
>  <link rel="stylesheet" type="text/css" href="tst.css" >
>  <jsp:include page="tst.js" flush="true" />
> </head>
> <body>
> <h1>Tst.jsp is OK!</h1>
> </body>
> </html>
> is producing an IllegalStateException on the inclusion of the tst.js file
> when using
> the current jakarta-tomcat-4.0 binary release. The same tst.jsp file works
> fine
> when using the jakarta-tomcat-3.2.3 release. I don't see that I have much
> control
> preventing the call to obtain the request output stream so how do I
> this
> error, and is this valid behavior? The full exception is given below as
> as the tst.css and tst.js files.

The behavior is valid, but is easy to fix.
Here, the JSP page uses a writer. Since the static page server is also a
servlet, it can't use an output stream to output the data (you'll get that
ISE if you call getOutputStream()). It will attempt to use the writer in
that particular case, but only if the file being included is a text file
(it's the case here, but there's no MIME type for .js).
The test used is that the MIME type of the included file has to be starting
with "text".

Adding the following mapping in your web.xml should make it work:


View raw message