Struts2 action with stream result type and input result to targets

1.1k Views Asked by At

Hi I would like to know how can I define the targets of based on the action result.

I have the next action:

struts.xml:

<action name="download" class="com.XXX.XXX.webapp.DownloadAction">
        <result name="success" type="stream">
          <param name="contentType">application/octet-stream</param>
          <param name="inputName">inputStream</param>
          <param name="contentDisposition">attachment;filename="${fileName}"</param>
          <param name="bufferSize">4096</param>
        </result>
         <result name="input">/WEB-INF/pages/XXX/downloadDoc.jsp</result>
</action>

downloadDoc.jsp:

...
..
<s:div id="div_to_charge">
        <s:form id="formDownload" action="download">   
        ...
        ..
            <sj:submit
            button="true"
            targets="div_to_charge"
            formIds="formDownload"/>
        </s:form>
        ...

</s:div>
...
..

I need to charge the input result in the same pop-up, for this reason I put the targets in the <sj:submit>. But the problem It´s when the action result it´s SUCCESS , because it print the stream inside the <div>

Can I define the targets based on result name?

0

There are 0 best solutions below