public ActionForward openFile(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
System.err.println("===com.eastpro.batch.action.BankBillingAction.openFile===begin===");
String fileName=request.getParameter("fileName");
String filePath="";
try{
response.setContentType("text/plain; charset=UTF-8");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Charset", "UTF-8");
Function ff = new Function();
Collection sys_result = ff.getSysParam();
Data sys_data = (Data) sys_result.iterator().next();
String exportPath = sys_data.getVcharProperty("export_path").trim();
sys_data = null;
sys_result = null;
ff = null;
filePath=exportPath+fileName;
OutputStream out=response.getOutputStream();
File file=new File(filePath);
InputStream is = new FileInputStream(file);
byte temp[] = new byte[100 * 1024];
int i=0;
while((i=is.read(temp))!=-1){
out.write(temp, 0, i);
}
out.flush();
out.close();
out=null;
}catch (Exception e){
System.err.println("Error: com.eastpro.batch.action.BankBillingAction.openFile()");
e.printStackTrace();
}
System.err.println("===com.eastpro.batch.action.BankBillingAction.openFile===end===");
return null;
}
public ActionForward openFileOri(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
System.err.println("===com.eastpro.batch.action.BankBillingAction.openFile===begin===");
String fileName=request.getParameter("fileName");
String filePath="";
try{
response.setContentType("text/plain; charset=UTF-8");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Charset", "UTF-8");
Function ff = new Function();
Collection sys_result = ff.getSysParam();
Data sys_data = (Data) sys_result.iterator().next();
String exportPath = sys_data.getVcharProperty("export_path").trim();
sys_data = null;
sys_result = null;
ff = null;
filePath=exportPath+fileName;
OutputStream out=response.getOutputStream();
File file=new File(filePath);
BufferedReader in=new BufferedReader(new FileReader(file));
String strLine="";
byte temp[] = new byte[100 * 1024];
while((strLine=in.readLine())!=null){
temp=strLine.getBytes();
out.write(temp, 0, temp.length);
}
out.flush();
out.close();
out=null;
}catch (Exception e){
System.err.println("Error: com.eastpro.batch.action.BankBillingAction.openFile()");
e.printStackTrace();
}
System.err.println("===com.eastpro.batch.action.BankBillingAction.openFile===end===");
return null;
}