"Creative Digital Publishing Inc." wrote:
>
> I'm trying to create my first server-side include servlet running on an
> Apache server. I reference it using:
>
> <HTML><HEAD>
> <TITLE>ssitest.jhtml</TITLE>
> </HEAD><BODY>
> <SERVLET CODE="PageHeader"> Servlet not found. </SERVLET>
> </BODY></HTML>
>
> The servlet has the following general structure (based on the brief example
> in the O'Reilly book):
>
> public class PageHeader extends HttpServlet {
> public void doPost ( ...req, ....res ) throws ........{
> PrintWriter out = res.getWriter ();
> out.println ( "a long HTML string" );
> } }
>
> When I try to fetch it using IE 4.5 on a Mac, I get:
>
> Java Server Side Include Error
> Requested URI /hhca/ssitest.jhtml is not a file. Please, make sure you
> request a java server side include file.
>
> When I try to fetch it using IE 4.0 on a Windows NT box, I get:
>
> java.lang.IllegalStateExceptiion: Already called getOutputStream.
>
> Would anyone have any idea what the problem might be? Thanks.
It looks like Apache JServSSI uses the response.getOutputStream method
to get a stream for sending all the static HTML in the page before calling
servlets included with SERVLET tags. In your servlet you then try to call
response.getWriter which causes the IllegalStateException since only one
of the the methods can be called on the same response object.
Try using response.getOutputStream in your servlet instead and I'm sure it
works better. You may also like to file a bug report on JServSSI since it
would make more sense for it to use the getWriter method.
--
Hans Bergsten [EMAIL PROTECTED]
Gefion Software http://www.gefionsoftware.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html