---
title: "得到web项目的真实路径"
author: "weishuwei"
date: "2007-04-12T14:23:20Z"
tags: []
slug: "web"
draft: false
lastmod: "2007-04-12T14:23:20Z"
id: 70271
url: "https://weishuwei.iteye.com/blog/70271"
---

@Override  
 public void init(ServletConfig config) throws ServletException {  
  // TODO Auto-generated method stub  
    
  ServletContext application =config.getServletContext();  
  String realPath=application.getRealPath("/");  
//  得到[http://localhost:8080/](http://localhost:8080/)项目上下文/  
 }