---
title: "jsp 读取配置文件"
author: "ts88"
date: "2013-01-29T19:58:57Z"
tags: []
categories: ["编程语言"]
slug: "jsp"
draft: false
lastmod: "2013-01-29T19:58:57Z"
id: 1779357
url: "https://ts88.iteye.com/blog/1779357"
---

```java

private String getData(String key) {
        InputStream inputStream = this.getClass().getClassLoader()
                .getResourceAsStream("conf/upload-image.properties");
        Properties p = new Properties();
        try {
            p.load(inputStream);
        } catch (IOException e1) {
            e1.printStackTrace();
        }
        return p.getProperty(key);
    }
```