I am a new bie, i want files to get downloaded when user clicks on download option its opening in the browser instead of download option like save as/open.Here i referred for the same and every where they have suggested to use
Response.AddHeader("Content-disposition", "attachment; filename=" + Name);
But i don't know where and how to use. Actually i'm getting the url value from query written which return url as one of the object of bean stored in arraylist(This list is having other values also with url ). I am having the url values inside the arraylist as bean as like
type=.pdf
release date=12/3/08
name=hai.pdf
url=/files/en/soft/doc/docs/hai.pdf
I am getting this array list in my controller like this
ArrayList details = dao.getdetails(Bean.getNumber());
and pass this into view like this
Map.put("details", details);
modelView.setViewName("details_list");
modelView.addAllObjects(Map);
return modelView;
in jsp i have iterated this array list and diplays the content like this
Type name Release Date
.txt hai.pdf May 21st 2012 Download
.txt hello.txt May 21st 2012 Download
For download i have used like this in jsp
<td colspan="2" valign="top">
<a href="${details.Url}"/>
<img src="/images/download.gif" alt="Download" border="0" align="right"></a>
</td>
here on click of download its opening in browser.I need this to be downloaded instead. Please help me in how to use or handle
response.setHeader("Content-Disposition", "attachment;");
where to add the above for my requirement or if i can do with any java script also.Please help me in solving the above.