I want to run two action results from the struts.xml file off of one click from a submit button on a form. Is this possible, and if so how? I have a short example below:
After hitting my submit button on my form is there anyway in struts2 to run both action result success_csv and reload the page with result success
I have a form on my index.jsp such as:
<form id="example" name="example" action="makecsv" >
<!-- form sutff -->
<input class="submit" type="submit" value="Submit" >
</form>
In my strut.xml file I have this action:
<action name="makecsv" class="com.example.actions.MakecsvAction">
<result name="success_csv" type="stream">
<param name="contentType">image/jpeg</param>
<param name="inputName">fileStream</param>
<param name="contentDisposition">attachment;filename="${filename}"</param>
<param name="bufferSize">1024</param>
</result>
<result name="success"> index.jsp </result>
</action>
Action result success_csv will stream out a file that the user can save or open. Action result success will open index.jsp.
Also my action file MackcsvAction.java:
public class RegisterAction extends ActionSupport
{
public String execute() throws Exception
{
//blahblah code that creates csv file
//sets the filename and fileStream of the file
return "succes_csv";
}
}
Right now it only gives the csv file I would like it also to open index.jsp