Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Export data to csv file using Struts Action & Servlet Or Struts DownloadAction - HELP PLZZZ

John P Joseph
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone,

I tried two approaches to export CSV data and each one gives a different issue.

Approach 1 - Using a Struts Action class and Servlet

Here the problem is when i export the file, it gives me an option to save/open the file and after that the mouse cursor will show the waiting icon and i cant do anything on the browser window. the browser completely freeze there and i cant do anything on it unless i refresh the page. Anybody know whats going on here? See the code below:

Struts action class

Export Servlet

Toggle HighlightingOpen in New WindowSelect All

Struts.xml file entry.

<action path="/filedownload" type="com.myapp.ExportUserDetail" name="myForm" scope="session" validate="false">

Approach 2 - Using a Struts DownloadAction class

This approach is giving me new issue. I got the below error when i tried to execute the ReportDownload Action class. code attached


<Jun 7, 2011 4:55:23 PM CDT> <Warning> <org.apache.struts.action.RequestProcessor> <BEA-000000> <Unhandled Exception thrown: class java.lang.IllegalStateException>

My Class which extends DownloadAction

Finally when i ran the application, console printed the SOP line inside the getInputStream function and then i got the "RequestProcessor" error message which is given above.

I am running out of options here. Please help
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic