magicboylinw 的 Java 编程世界

Hello,java!

导航

Java Path 问题(二)

 

 1 /**
2 * 对于 J2EE,可以使用 ServletContext.getResource,她根据相对路径获得绝对路径的 URL
3 * 相对路径以 ContextPath 为第一参考路径,以 /WEB-INF/lib 中 Jar 包的 /META-INF/resources 为第二参考路径
4 * 相对路径必须以 “/” 开头
5 */
6 ServletContext.getResource
7 /**
8 * ServletContext.getRealPath 不推荐使用
9 */
10 ServletContext.getRealPath

posted on 2011-11-22 15:48  magicboylinw  阅读(173)  评论(0编辑  收藏  举报