lz是用jsp吗?如下
<%@page import="java.io.InputStream" %>
<%@page import="java.util.Properties" %><%
    InputStream is= application.getResourceAsStream("/db.properties");
    Properties props = new Properties();
    props.load(is);
%>

解决方案 »

  1.   

    lz是用jsp吗?如下
    <%@page import="java.io.InputStream" %>
    <%@page import="java.util.Properties" %><%
        InputStream is= application.getResourceAsStream("/db.properties");
        Properties props = new Properties();
        props.load(is);
    %>
      

  2.   

    InputStream in = new FileInputStream(path);
    Properties property = new Properties();
    property.load(in);
    ResourceBundle bundle = ResourceBundle.getBundle("db");
    String driverClassName = bundle.getString("driverClassName");
      

  3.   

      InputStream in = new FileInputStream(path);
      Properties property = new Properties();
      property.load(in);
     ResourceBundle bundle = ResourceBundle.getBundle("db");
    String userName = bundle.getString("userName");
      

  4.   


    InputStream in = FileOperateUtils.class.getClassLoader().getResourceAsStream("/sys.properties");
    if(in == null){
    in = FileOperateUtils.class.getClassLoader().getClass().getResourceAsStream("/sys.properties");
    }