I want to download xml file with my struts application. I recup my xml in JAVA (in my action) . When I click to my link, the download window doesn't open . This my code : ACTION :
@Action(value = "download", results = {
@Result(name = "success", type = "redirectAction", params = {
"actionName", "testMM"}),
@Result(name = "input", location = "testMM.jsp") })
public String dowload() {
setFilePath(getSession().get("filePath", String.class));
setFileName(getSession().get("fileName", String.class));
try {
fileInputStream = new FileInputStream("c://mm.xml");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return SUCCESS;
}
/**
* @return the fileInputStream
*/
public InputStream getFileInputStream() {
return fileInputStream;
}
MY JSP:
<s:url id="fileDownload" namespace="/adminMM" action="download" ></s:url>
<s:a style="width: 300px; maring: 15px 25px;" href="%{fileDownload}"><s:text name="%{resultFileName}" /></s:a>
Please I need help . I can give you more information .