SoftFrance RANSON Maxime wrote:

> Can't I use the method
> response.getOutputStream()
> in a Jsp file ?
>
> I got the Error
> Writer is already being used for this request, does anybody
> solve this problem, where does it come from ?
>

It comes from the fact that the beginning of the service() method in the servlet
generated for your JSP page has something like this in it:

    JspWriter out = response.getWriter();

which means that the writer has already been grabbed.  Based on the servlet
specification, that means (therefore) that you cannot also access the output
stream via response.getOutputStream() inside that same page.  If you want to
dynamically create output from scriptlets in your JSP page, all you need to do is
use the already existing implicit variable:

    <%
        out.println("<b>This is some bold text!</b>");
    %>

Alternatively, if you want to create binary output instead, you should use a real
servlet.

Craig McClanahan

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to