落地式数据是被持久化的 可以存在临时路径中,比如:页面展示的图片 文档 存在数据库中
不落地式数据是存在内存里 使用后会消失 比如:我们在浏览器发送给服务器的请求;
从数据库读取出来的一直到页面展示前的数据等等。
不落地式的性能好些.
<%@ page contentType="text/html; charset=GBK"%>
<%@ page import="java.net.*"%>
<%@ page import="java.io.*"%>
<%@ page import="java.util.zip.*"%>
<%@ page import="java.awt.image.*"%>
<%@ page import="java.awt.*"%>
<%@ page import="javax.imageio.*"%>
<%@ page import="javax.imageio.stream.*"%>
<%
String[] fileNames = request.getParameterValues("fileNames");//request获取参数名相同的一个数组
response.setContentType("application/x-download");//设置下载为application/x-download 主要就是是客户端浏览器用来区分不同种类的数据
response.setHeader("Content-Disposition", "attachment;filename=pictures.zip" );
// 使用输出流检查
ZipOutputStream zipOutput = new ZipOutputStream(response.getOutputStream());
try {
for (int i = 0; i < fileNames.length; i++) {
File file = new File(fileNames[i]);
System.out.println("Write file " + file.getPath());
if (!file.exists()) {
continue;
}
zipOutput.putNextEntry(new ZipEntry(file.getName()));
FileInputStream in = new FileInputStream(file);
int c ;
while ((c = in.read()) != -1) {
zipOutput.write(c);
}
in.close();
}
zipOutput.putNextEntry(null);
zipOutput.flush();
out.clear();
out = pageContext.pushBody();
} catch (Exception e) {
System.out.println("Error!");
e.printStackTrace();
}
%>
<%@ page contentType="text/html; charset=GBK"%>
<%@ include file="/IncludeBegin.jsp"%>
<%@ page import="com.amarsoft.impl.szpab.ei.*" %>
<%@ page import="com.amarsoft.are.util.*" %>
<%
Transaction SqlcaRepository1 = null;
Transaction Sqlca_des = null;
String sDataSource_des = CurConfig.getConfigure("DataSource_Des");
try{
javax.sql.DataSource ds1 = ConnectionManager.getDataSource(sDataSource_des);
SqlcaRepository1 = ConnectionManager.getTransaction(ds1);
}catch(Exception ex) {
ex.printStackTrace();
throw new Exception("连接数据库失败!连接参数:
DataSource:"+sDataSource_des);
}
Sqlca_des = SqlcaRepository1;
List
naspaths = new ArrayList
();
try {
String sBar_Code = DataConvert.toRealString(iPostChange,(String)CurComp.getParameter("BarCode"));
String sObjectNo = DataConvert.toRealString(iPostChange,(String)CurComp.getParameter("ObjectNo"));
System.out.println("sBar_Code-------------------------------------"+sBar_Code);
System.out.println("sObjectNo-------------------------------------"+sObjectNo);
String sSql2="select * from student";
System.out.println("sSql-------------------------------------"+sSql2);
ASResultSet rset2 = Sqlca.getASResultSet(sSql2);
while (rset2.next()) {
System.out.println("have:"+rset2);
String naspath = DataConvert.toString(rset2.getString("naspath"));
naspaths.add(naspath);
}
rset2.close();
}catch(Exception e){
}
finally{
if(Sqlca_des!=null)
{
Sqlca_des.conn.commit();
Sqlca_des.disConnect();
Sqlca_des = null;
}
}
%>
name="MyAtt" src="<%=sWebRootPath%>/Blank.jsp?TextToShow=正在下载附件,请稍候..." width=100% height=100% frameborder=0 hspace=0 vspace=0 marginwidth=0 marginheight=0 scrolling="no">