String path=request.getRealPath(".");//得到根目录的绝对路径
FileOutputStream out=new FileOutputStream(path+"\\TreeNode.xml");//这里你可以根据path转换到想要的目录