Xavier, Does getContent.do return anything? I ask because your error was shown to be JSP level, not servlet level. Are you returning 'null' from your action or do you invoke a forward to go to a JSP .... after .... you have closed your output stream with os.close() ? At that point I expect you to return null instead of an actionForward.
Regards, David -----Original Message----- From: Xavier Vanderstukken [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 13, 2005 4:35 PM To: Struts Users Mailing List Subject: Re: Target servlet called getWriter(), then getOutputStream() The problem occurs after a click on this link : <html:link href="#" onclick="window.open('getContent.do?searchid=${id}&childrentype=FOO');" styleId="simplelink"> But also if I manually call the action on a new browser tab. The getContent.do write a datahandler to the stream : response.setContentType(mimetype); OutputStream os = response.getOutputStream(); tosend.writeTo(os); os.flush(); os.close(); Remember my first mail, the problems occurs only after calling an other action like that : <html:form action="/updateContent.do" method="post" enctype="multipart/form-data"> <bean:message key="updatecontent" /> <html:file property="contentfile"/> <html:hidden property="root" value="${id}"/> <html:hidden property="type" value="METADATA"/> <html:submit/> </html:form> And the updatecontent action look like that (I remove all my business logic): request.setAttribute(Constants.Result,array); return mapping.findForward("successthumb"); So no getstream in this action. David G. Friedman wrote: >Why do you write that your Struts Action is the place that your code is >printing the raw file yet your stack trace shows you are in a JSP? Is your >JSP invoking an action? If so that's your problem: everything is probably >already committed, Stream-wise that is. How are you getting to this action >code you included from a JSP? Shouldn't JSP's and taglibs only use the >Writer? Mixing that by calling some sort of action to get OutputStream >doesn't sound like a good idea, at least not according to the Tomcat Servlet >docs on interface ServletResponse method getOutputStream() and getWriter(): >Either this method or getWriter() may be called to write the body, not both. > >Regards, >David > >-----Original Message----- >From: Xavier Vanderstukken [mailto:[EMAIL PROTECTED] >Sent: Tuesday, September 13, 2005 1:30 PM >To: Struts Users Mailing List >Subject: Re: Target servlet called getWriter(), then getOutputStream() > > >Any idea? > >Xavier Vanderstukken wrote: > > > >>I have a jsp page with 3links : >>- One open a popup and write a file in this popup >>- One to display some text informations on the same page >>- One to upload a file to the server (in fact the file displayed in >>the first link) >> >>The three link seems to work well however when I upload a new file >>(the new file is successfully uploaded) but after that the two others >>links are broken >> >>The instruction that produced the stack trace is on the struts action >>that write the file : >> >> response.setContentType(mimetype); >> OutputStream os = response.getOutputStream(); // >><---- This line generates the stack >> tosend.writeTo(os); >> os.flush(); >> >>I dont know why because I can call several time the method and it >>works well, the problem only occurs after an upload of a new file >> >>javax.servlet.jsp.JspException: ServletException in 'page.jsp': >>Unexpected internal error during <import>: Target servlet called >>getWriter(), then getOutputStream() >> at >> >> >> >org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.j a >va:923) > > >> at >>org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:462) >> at >> >> >> >org.apache.jsp.layout_jsp._jspx_meth_tiles_insert_2(org.apache.jsp.layout_j s >p:207) > > >> at >> >> >> >org.apache.jsp.layout_jsp._jspx_meth_html_html_0(org.apache.jsp.layout_jsp: 1 >28) > > >> at org.apache.jsp.layout_jsp._jspService(org.apache.jsp.layout_jsp:73) >> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) >> at >> >> >> >org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java: 3 >22) > > >> at >>org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) >> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) >> at >> >> >> >org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicatio n >FilterChain.java:252) > > >> at >> >> >> >org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC h >ain.java:173) > > >> at >> >> >> >org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher . >java:672) > > >> at >> >> >> >org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDi s >patcher.java:463) > > >> at >> >> >> >org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatc h >er.java:398) > > >> at >> >> >> >org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatche r >.java:301) > > >> at >> >> >> >org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1 0 >63) > > >> at >> >> >> >org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcess o >r.java:263) > > >> at >> >> >> >org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesR e >questProcessor.java:239) > > >> at >> >> >> >org.apache.struts.tiles.TilesRequestProcessor.internalModuleRelativeForward ( >TilesRequestProcessor.java:341) > > >> at >> >> >> >org.apache.struts.action.RequestProcessor.processForward(RequestProcessor.j a >va:560) > > >> at >> >> >> >org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:209 ) > > >> at >>org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) >> at >>org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) >> at >> >> >> >org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicatio n >FilterChain.java:252) > > >> at >> >> >> >org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC h >ain.java:173) > > >> at >> >> >> >org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j a >va:213) > > >> at >> >> >> >org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.j a >va:178) > > >> at >> >> >> >org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:12 6 >) > > >> at >> >> >> >org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:10 5 >) > > >> at >> >> >> >org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.jav a >:107) > > >> at >> >> >> >org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) > > >> at >>org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) >> >> at >> >> >> >org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConn e >ction(Http11Protocol.java:744) > > >> at >> >> >> >org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.ja v >a:527) > > >> at >> >> >> >org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerW o >rkerThread.java:80) > > >> at >> >> >> >org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.ja v >a:684) > > >> at java.lang.Thread.run(Unknown Source) >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: [EMAIL PROTECTED] >>For additional commands, e-mail: [EMAIL PROTECTED] >> >> >> > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]