Thanks for that. that gives me a better idea to go about things + i
didnt know we can call methods from struts.xml


i implemented this but am getting this error

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)



my getExcelStream looks like this

    public ServletOutputStream getExcelStream()
    {
        return this.stream;
    }

excelDownload method has this that sets up the stream.
         stream = response.getOutputStream();
         wb.write(stream);

wb is the worksheet...



On 2/7/08, Dale Newfield <[EMAIL PROTECTED]> wrote:
bhaarat Sharma wrote:
> > I think its better if i post some code.
> >
> > This is the action mapping for
> >    <action name=\\\"accessRequestReportResult\\\"
> > class=\\\"action.reports.AccessRequestReportResult\\\">
> >     <result 
> > name=\\\"showReport\\\">/useradmin/AccessRequestReport.jsp</result>
> >     <result name=\\\"failure\\\">login.jsp</result>
>        <result name=\"excel\" type=\"stream\">
>          <param name=\"contentType\">application/vnd.ms-excel</param>
>          <param name=\"inputName\">excelStream</param>
>          <param
> name=\"contentDisposition\">attachment;filename=\"${excelFilename}\"</param>
>          <param name=\"bufferSize\">1024</param>
>          <!-- if you know the content length you should add the
> contentLength parameter -->
>       </result>
> >    </action>
>
>
> > this is my execute method:
> >
> >
> >     public String execute() throws IOException, ServletException {
> >
> >         //we dont enter here for excel
> >          if (getServletRequest().getParameter(\\\"isExcel\\\")==null)
> >         {
> >             setData(getActionValue());
> >             return \\\"showReport\\\";
> >         }
> >       //enter here for excel
> >         else
> >         {
>                do whatever it takes to set the action up so that when
> getExcelStream() is called the appropriate stream is returned, and when
> getExcelFilename() is called, the appropriate filename is returned.
>                return \"excel\";
> >         }
> >
> >     }
>
> -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]

Reply via email to