Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>EDIT</strong></p> <p>In the new posted code, you are doing two "bad" things:</p> <p><strong>1) You are swallowing an exception</strong>, that is really really wrong;</p> <p>put a </p> <pre><code>e.printStackTrace(); </code></pre> <p>inside your </p> <pre><code>catch(Exception e){} </code></pre> <p>block, and you will see the Exception that is probably being throwed, catched and not showed;</p> <p><strong>2) You are returning the same result even if you get an Exception</strong>, (that is 99.9% what is happening); this will result in Struts2 Stream result trying to reach the excelStream variable that was never initialized (because of the exception).</p> <p>In case of error, you should return an global (or local) error result type, with a JSP showing the error, instead of a Stream result type.</p> <p>Print the exception, correct the code, and then everything will be alright :)</p> <p>P.S: Please avoid writing in the response directly, use contentDisposition from the Stream result type.</p> <hr> <p>The error is</p> <pre><code> &lt;param name="inputName"&gt;excelstream&lt;/param&gt; </code></pre> <p>should be </p> <pre><code> &lt;param name="inputName"&gt;excelStream&lt;/param&gt; </code></pre> <p>Always use camelCase (as you did in the Action, but not in struts config). </p> <p>And obviously contentDisposition should be removed, or set with a proper value, like</p> <pre><code> &lt;param name="contentDisposition"&gt;attachment; filename="myExcel.xls"&lt;/param&gt; </code></pre>
    singulars
    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.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      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