当前位置:编程学习 > JS >>

一种新的编程思路(下):附 ntGBDP2002.jsp

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 );
--%>

补充:Web开发 , Jsp ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,