Este modo de imprimir usando JasperReport está correto?

ola pessoal tenho um jsp que imprime em pdf mas os metodos que uso estão tachados na IDE do netBeans 6.5. existem outros que possa ser substituidos ou usa-se esses mesmo?

veja

<%

        try {
            java.sql.Connection conexao = HibernateUtil.getSession().connection();//.connection() esta tachado na netbeans
            String path = getServletContext().getRealPath("WEB-INF/reports") + "/";
            String imagem = getServletContext().getRealPath("images") + "/logo1.gif";
            String relatorio = path + "relatorioEleitores.jasper";
            Map parameters = new HashMap();
            parameters.put("ELEICAO", Integer.parseInt(request.getParameter("idEleicao")));
            parameters.put("IMAGEM", imagem);
            JasperPrint impressao = JasperFillManager.fillReport(relatorio, parameters, conexao);
            JasperManager.printReportToPdfStream(impressao, response.getOutputStream());//JasperManager.printReportToPdfStream esta tachado no netbeans
            conexao.close();
        } catch (Exception e) {
            out.println("ERRO! Relatorio não gerado:");
            out.println("<br><br>");
            out.println(e.getMessage());
            out.println("<br><br>");
            out.println(e.getCause());
        }
        %>

obtive outra maneira que substitui os tachados os relatorios funcionam normalmente e mostra em pdf dentro do extjs tudo certinho. o problema que ao observar na saida do glassfish o este erro não some o que pode ser?

StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: PWC3991: getOutputStream() has already been called for this response
at org.apache.coyote.tomcat5.CoyoteResponse.getWriter(CoyoteResponse.java:701)
at org.apache.coyote.tomcat5.CoyoteResponseFacade.getWriter(CoyoteResponseFacade.java:210)
at org.apache.jasper.runtime.JspWriterImpl.initOut(JspWriterImpl.java:171)
at org.apache.jasper.runtime.JspWriterImpl.flushBuffer(JspWriterImpl.java:164)
at org.apache.jasper.runtime.PageContextImpl.release(PageContextImpl.java:221)
at org.apache.jasper.runtime.JspFactoryImpl.internalReleasePageContext(JspFactoryImpl.java:157)
at org.apache.jasper.runtime.JspFactoryImpl.releasePageContext(JspFactoryImpl.java:108)
at org.apache.jsp.relConfZerezima_jsp._jspService(relConfZerezima_jsp.java from :102)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:568)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

pesquisando eu percebi que não posso usar mais de uma vez o metodo response.getOutputStream();. Se observar neste jsp não contem outro mas acho que dentro do servlet ja contem. Como posso pegar o meu outputStram então para acabar com essa exception?

até retornei um topico antigo

http://www.guj.com.br/posts/list/19660.java