Viral_Thakkar wrote:

Data is available on the jsp page. I need to convert this to excel file
on click of a button. Is there any way in struts to do this?

If it you just want the page to display as is in Excel either
1) Use Tiles or Sitemesh and make sure your content opens in the Excel layout with the top of the layout having:


<% response.setContentType("application/vnd.ms-excel");
   response.setHeader("Pragma", "");
   response.setHeader("Cache-Control", "max-age=0"); %>

2) reuse the same JSP but have a test for an Excel flag at the top and create the same response header as above

If you need a 'true' Excel document I've been messing with JExcel and like it. http://www.andykhan.com/jexcelapi/ It's faster than POI.

By the way the two lines
response.setHeader("Pragma", "");
response.setHeader("Cache-Control", "max-age=0");
were needed to content with a bug in IE using Excel format across https. If you aren't use https you only need the first line
response.setContentType("application/vnd.ms-excel");


--
Rick

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to