Note that there are some explanatory texts on larger screens.

plurals
  1. POstruts 2 Can not find a java.io.InputStream with the name [excelStream] in the invocation stack
    primarykey
    data
    text
    <p>excelStreamI am trying to download an excel file.</p> <p>In my Action class</p> <pre><code>public class ActivityTrackerExlReportAction extends BaseAction { private InputStream excelStream; private UserMasterDTO userMasterDTO; public InputStream getExcelStream() { return excelStream; } public void setExcelStream(InputStream excelStream) { this.excelStream = excelStream; } ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); WorkbookSettings wbSettings = new WorkbookSettings(); try { response.setHeader("Content-Disposition", "attachment; filename=/timesheet.xls"); wbSettings.setLocale(new Locale("en", "EN")); WritableWorkbook workbook = Workbook.createWorkbook(outputStream, wbSettings); workbook.createSheet("Report", 0); WritableSheet excelSheet = workbook.getSheet(0); service.createLabel(excelSheet); service.createContent(excelSheet); workbook.write(); ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray()); setExcelStream(inputStream); workbook.close(); outStream.flush(); outStream.close(); } catch(Exception e) { } finally { // outStream.close(); } return "generateReport } </code></pre> <p>My <code>struts.xml</code> contains:</p> <pre><code>&lt;result type="stream" name="generateReport"&gt; &lt;param name="contentType"&gt;"application/vnd.ms-excel"&lt;/param&gt; &lt;param name="inputName"&gt;excelStream&lt;/param&gt; &lt;param name="bufferSize"&gt;1024&lt;/param&gt; &lt;/result&gt; </code></pre> <p>I am using <code>JXL</code> to create and write an Excel sheet. Why am i getting the error and how to get out of it? Can not find a <code>java.io.InputStream</code> with the name <code>[excelStream]</code> in the invocation stack</p> <p>My are Stacktraces:</p> <blockquote> <p>java.lang.IllegalArgumentException: Can not find a java.io.InputStream with the name [excelStream] in the invocation stack. Check the tag specified for this action.</p> <p>org.apache.struts2.dispatcher.StreamResult.doExecute(StreamResult.java:237)</p> <p>org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186) .......</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload