我寫了一個文件上傳和下載在struts2。 但是,當我下載在瀏覽器頁面中打開的text.pdf
文件時, 如何下載文件而不是在瀏覽器頁面中打開?下載文件,而不是在瀏覽器中使用struts2打開
<div class="block-fluid table-sorting clearfix">
<table cellpadding="0" cellspacing="0" width="100%" class="table" id="tSortable">
<thead>
<tr>
<th>S. No</th>
<th>ACCOUNT NO</th>
<th>FILE </th>
<th>ACTION</th>
</tr>
</thead>
<tbody>
<s:iterator value="fileuploadlist" status="rowstatus" >
<tr>
<td><s:property value="#rowstatus.index+1" /></td>
<td><s:property value="fileupload_temp2" /></td>
<td><s:property value="fileupload_filename"/></td>
<td><s:a href="%{fileupload_filepath}" target="_blank" >download</s:a> </td>
</tr>
</s:iterator>
</tbody>
</table>
</div>
這可能是瀏覽器特定的設置。 –