views:

167

answers:

2

I have implemented export to excel feature in struts 2 using apache POI. It works in IE7 and Firefox on Windows XP.

But does not work in IE6. The pop up dialog to open or save excel does not show up on IE6. I get no errors or exceptions.

This is the result type.

<action name="exportToExcelRIQueue" class="queuesAction" method="exportToExcelRIQueue">
            <result name="export.to.excel" type="stream">
                <param name="contentType">application/vnd.ms-excel</param>
                <param name="inputName">inputStream</param>
                <param name="contentDisposition">attachment; filename="RequiringInstructions.xls"</param>
                <param name="bufferSize">1024</param>
            </result>
</action>
A: 

I found this thread on the Sun Forums discussing issues with downloading attachments in IE. Unfortunately none of them point to a specific cause. You may want to change your contentType from application/vnd.ms-excel to a more generic application/octet-stream and see if that works.

technomalogical
Thanks. But it does not work either. I even wrote a separate servlet and tried to set all types of response header values as suggested in the forum posts. It just doesnt open the pop up.
apat
A: 

This problem is solved now. Issue with the Custom link tag.

I was using a custom link tag(designed by company as part of UI standard) to invoke the action. Unfortunately this custom tag had issues in IE6.

I have replaced it with html anchor tag <a></a> . And used javascript to submit the struts 2 form.

It works perfectly in IE6. Opens up a pop up dialog to open or save Excel returned from Struts 2 result. :)

apat