日期:2014-05-18  浏览次数:20655 次

关于服务器路径的问题。
我用的是tomcat服务器,有一个类xml,用来创建xml文件,并写文件,创建文件的方法如下,我的参数_path应该是什么啊,总是建不了,我要在struts   action里new一个xml类,然后执行方法。各位大侠帮帮忙
public     boolean     createFile(String   _path,String   _fileName)throws   IOException     {    
boolean     success   =     false;    
String   fileName   =     _fileName;    
String   filePath   =     _path;    

try     {    
File   file   =   new   File(filePath);    
if     (!file.isDirectory()){    
file.mkdirs();    
}

------解决方案--------------------
传相对路径,绝对路径都可以的。