>What you need to do is provide the result with a source of the >data to be sent to the client.
and that data has to be in java.io.InputStream?? even if my getExcelStream method returns java.io.OutputStream...I still get an exception so what TYPE of data should getExcelStream be returning :( seems i am so close to fixing this.... On 2/7/08, Dale Newfield <[EMAIL PROTECTED]> wrote: bhaarat Sharma wrote: > > Thanks for that. that gives me a better idea to go about things + i > > didnt know we can call methods from struts.xml > > http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/dispatcher/StreamResult.html > > describes how that result works, stating taht the \"inputName\" parameter > is \"the name of the InputStream property from the chained action > (default = inputStream)\" > > The filename expression works because this result extends > http://struts.apache.org/2.x/struts2-core/apidocs/org/apache/struts2/dispatcher/StrutsResultSupport.html > which allows for ognl expressions in result parameters (if the parse > parameter is true, which is the default). > > > java.lang.ClassCastException: org.apache.coyote.tomcat5.CoyoteOutputStream > > > > org.apache.struts2.dispatcher.StreamResult.doExecute(StreamResult.java:182) > > > > org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:178) > > > > com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:348) > > > > com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:253) > > That\'s saying that it can\'t cast a \"CoyoteOutputStream\" as an > InputStream. The result will manage the output to the client. You > shouldn\'t need to deal with the response or the servlet. What you need > to do is provide the result with a source of the data to be sent to the > client. > > Note that every call to getExcelStream needs to return an independent > InputStream. For example, when you don\'t tell the result the > contentLength it has no choice but to step through the entire stream to > find the length, then it\'ll ask for a new stream to actually pull the > data out of to send to the client. > > -Dale > > --------------------------------------------------------------------- > 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]