当前位置:编程学习 > JAVA >>

模拟器,linux,weblogic怎么才能取到路径?

System.out.println("根目录所对应的绝对路径:"   +   request.getServletPath()   );   
    
String   strPathFile   =   request.getSession().getServletContext().getRealPath("/");   
System.out.println("文件的绝对路径:"   +   strPathFile   );   
   
String   strDirPath   =   new   File(request.getSession().getServletContext().getRealPath(request.getRequestURI())).getParent();   
System.out.println("目录的绝对路径:"   +   strDirPath   +   "<br/>");


web项目在模拟器里,是linux系统,用的是weblogic,对于路径怎么测都得到的都是null
本以为我写错了,可是在本地,tomcat里测试都能正常取到各种路径,所以跪求各位大神,原因和解决方案
模拟器 linux weblogic
补充:Java ,  Web 开发
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,