日期:2014-05-18  浏览次数:20749 次

WEB-INF下讀取properties文件提示存取被拒
我有DB.JAVA  

package   db;

import   java.io.*;
import   java.sql.*;
import   java.util.*;
import   javax.xml.parsers.*;
import   java.net.URL;

import   org.w3c.dom.*;

/**
  *   鏡扴:   杅擂踱蟀諉濬   Copyright   (c)   2005-2008   Wang   Xining
  *  
  *   @author   卼浀譴
  *   @version   1.0
  */

public   class   DB   {
static   String   driver   =   null;

static   String   server   =   null;

static   String   dbuser   =   null;

static   String   dbpassword   =   null;

static   int   minconn   =   0;

static   int   maxconn   =   0;

static   double   maxconntime   =   0.1D;

static   String   log_properties   =   null;

        static   ConnectionPool   p   =   null;
       
        private   static   String   resourcePath;
       
        private   static   Properties   configProperties   =   System.getProperties();


        static  
        {
        int   pos=0;
       
        URL   url   =   DB.class.getResource( "DB.class ");
       
        String   pkgName   =   DB.class.getPackage().getName();
       
        do
        {
        pos   =   pkgName.indexOf( ". ");
        if(pos> 0)
        {
        pkgName   =   pkgName.substring(0,pos)+ "/ "+pkgName.substring(pos+1);
        }
       
        }
        while(pos> 0);
       
        String   filePath   =   url.getFile();
       
        String   appPath   =   filePath.substring(0,filePath.indexOf( "/classes/ "+pkgName));
       
        resourcePath   =   appPath+ "/resources ";
       
        try
        {
        configProperties.load(new   FileInputStream(DB.getResourcePath()));
        }
        catch(FileNotFoundException   e)
        {
       
        e.printStackTrace();


        }
        catch(