2010-03-01 2 views

답변

0

클라이언트에서 다운로드 엑셀을 반환 예 :

// 자바 측 :

public FileTransfer getExcel(Parametros param){ 
    byte[] result = <here get data>; 
    InputStream myInputStream = new ByteArrayInputStream(result); 
    String excelFormat = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; 
    FileTransfer dwrExcelFile = new FileTransfer("excel.xlsx", excelFormat, myInputStream); 
    return dwrExcelFile; 
} 

// 자바 스크립트 측면 :

,
function downloadExcelFile() { 
    dwr.engine.setTimeout(59000); 
    var params = <params_to_send>; 
    <Java_class>.getExcel(params, {callback:function(dataFromServer) { 
    downloadExcelCallback(dataFromServer); 
    }}); 
} 

function downloadExcelCallback(data) { 
    dwr.engine.openInDownload(data); 
} 
관련 문제