データベースのBLOBタイプのデータファイルを読みだします。
1304 ワード
このブログを見る前に、このブログを見てください。http://blog.csdn.net/qciwyy/article/details/54092327
あるファイルの名前をクリックしたら、ファイルの内容をイジェクトします。
controllerコードは以下の通りです。
あるファイルの名前をクリックしたら、ファイルの内容をイジェクトします。
controllerコードは以下の通りです。
/**
*
*/
@RequestMapping(value = "/gafRead")
public void loadByDeployment(HttpServletResponse response,GafUploadRecord gafUploadRecord) throws Exception {
GafUploadRecord fileBytes = gafXmlService.getGafXMLStream(gafUploadRecord);
byte[] contents = fileBytes.getFile_bytes();
response.getOutputStream().write(contents);
}
jspコード(フレームワークyueasi):
" data-options="
rownumbers:true,
singleSelect:true,
fit:true,
method:'post',
fitColumns: true,
striped:true,
pagination:true,
collapsible: true,
idField: 'id',
toolbar: '#tb'
">
js
function formatXml(val,row){
var url = '${ctx}/dataEntryXML/gafRead?id='+row.id;
return ''+row.file_name+'';
}