ntGBDP2002.jsp(SUN企業級應用的首選)
---------------------------------------------------------------------
<%@page contentType="text/html;charset=GBK" %>
<%@page import="java.lang.*,java.net.*,java.sql.*" %>
<%@page import="java.text.*,java.util.*" %>
<%@page import="cint.ntDB" %>
<%@page import="com.jsp(SUN企業級應用的首選)smart.upload.*"%>
<%@page session="true" %>
<%@page errorPage="error.jsp(SUN企業級應用的首選)"%>
<%
file://上傳文件
if( isUpload && isPost && !uploaded )
{
mydir = new java.io.File( uploadDir ); file://uploadDir is GlobalVar
if( !mydir.exists() )
if( !mydir.mkdir() )
throw new Exception("創建上傳文件夾失敗![" + uploadDir + "]");
Files files = mySmartUpload.getFiles();
String sfilename ="";
try{
for(int i=0;i<files.getCount();i++){
com.jsp(SUN企業級應用的首選)smart.upload.File file = files.getFile(i);
sfilename = file.getFileName();
if( sfilename == null ) sfilename = "";
String s = sfilename ;
file://文件另存
// 20021231121212123_abc.zip
if( sfilename.length() <= (255-18-1) )
{
s = (new SimpleDateFormat("yyyyMMddHHmmssSSS")).format(new java.util.Date())
+ "_"
+ sfilename ;
}
file.saveAs( uploadDir
+ System.getProperty("file.separator")
+ s );
//
if( !s.trim().equals("") )
requestHt.put( "uploadFileName"+i , s );
} file://end for
file://try{
file://mySmartUpload.save(uploadDir);
}catch(Exception e){
throw new Exception("上傳文件失敗!"+ e.getMessage() );
}
uploaded = true ;
} // end if upload
%>
<%
file://全局數據->requestHt
requestHt.put("globalTableName",globalTableName);
requestHt.put("dbName",dbName);
requestHt.put("parentKey",parentKey);
requestHt.put("parentValue",parentValue);
requestHt.put("sql_trans",sql_trans);
%>
<%
if( !tableCreated )
{
nt.createTable( dbName , globalTableName );
tableCreated = true ;
}
%>
<%--
file://以後調用保存到數據庫
nt.toDB( requestHt );
--%>