ntGBDP2002_Define.jsp 
--------------------------------------------------------------------- 
<%   /*      *  GBDP2002新版, 注意使用的是cint.ntDB !!! ,支持INT    *  注意:本JSP被其他页面调用,不能产生额外的空格和回车    *    */ 
  file://全局变量定义    String globalTableName ;    String parentKey   ="" ;    String parentValue ="" ;    String dbName  = "mhoa";      ntDB ntP = new ntDB();     ntDB nt  = new ntDB();   String sql ;      String sql_trans = "" ; file://用来插入后面的保存到数据库的sql语句中,使其中在事务之中间   String sql_TRANS_ERROR = ntDB.sql_TRANS_ERROR ; 
  boolean isPost = false ;   {     isPost = request.getMethod().equals("POST");   }   boolean isEdit = false ;   boolean isAdd  = false ;   boolean isDelete = false ;   boolean isUpload = false ;   boolean uploaded = false ; file://表示已经上传完毕   boolean tableCreated = false ; file://表示数据库表已经建立   {     String contentType = request.getContentType();     if( contentType != null           &&          contentType.indexOf("multipart/form-data") != -1       )       isUpload = true;    }   boolean hasId = false;   boolean hasMasterId = false;      int maxReturnRows = 10000 ;   int id = 0 ; // 表示主记录id号,一般为1,2,3......,必须在ntGBDPUpload.jsp                //    中获取,因为当upload的情况无法从request中获取参数   int masterId = 0 ; // 同上       file://绝对路径   String realPath ; // like 'c:\a\'   {     realPath = getServletConfig().getServletContext().getRealPath("");   }      file://上传目录   String uploadDir;   {     uploadDir = realPath + "upload";   } 
  file://存放所有request的信息,使用它的原因是后面如果有upload的时候,   //   request将没有任何参数和值,必须从upload中重新找到   java.util.Hashtable requestHt;    {     requestHt = new java.util.Hashtable();     Enumeration e = request.getParameterNames();     while( e.hasMoreElements() )      {       String s = (String)e.nextElement();       String sValue = request.getParameter(s);       requestHt.put( s , sValue );     }     }      file://upload      java.io.File mydir = null ;   SmartUpload mySmartUpload = null ;      if( isPost && isUpload )   {     mySmartUpload=new SmartUpload();     mySmartUpload.initialize(pageContext);//初始化      mySmartUpload.upload();//上传分析     Request smartRes = mySmartUpload.getRequest();     {       file://将request参数传入requestHt全局变量       Enumeration e = smartRes.getParameterNames();       while( e.hasMoreElements() )        {         String s = ((String)e.nextElement()).trim();         String sValue = (smartRes.getParameter(s)).trim();         requestHt.put( s , sValue );       }       }   } %> 
<%   isEdit = isPost && requestHt.get("edit")!=null ;   isAdd  = isPost && requestHt.get("add")!=null  ;   isDelete  = requestHt.get("delete")!=null ;      // 这里当没有命令发出的时候,所有操作跳过      hasId = requestHt.get("id")!=null ;   id = 0 ;   if( requestHt.get("id")!=null )     id = Integer.parseInt( (String)requestHt.get("id") );        hasMasterId = requestHt.get("masterId")!=null ;   masterId = 0 ;   if( requestHt.get("masterId")!=null )     masterId = Integer.parseInt( (String)requestHt.get("masterId") ); 
%>
   
 
  |