关于webservice中读取文件的路径
环境eclipse + myeclipse +tomcat
在webservice的一个类中要读取一个xml文件,代码如下写的:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder=factory.newDocumentBuilder();
Document document = builder.parse(new File("abc.xml"));
那么,只能将abc.xml放在tomcat的安装目录的bin目录下,这样太傻了点。
abc.xml是服务的实现代码的类中需要用到的一些信息,应该放在什么地方好?并且怎样调用.
或者如果我放在web-inf下,怎样可以加载到这个路径.谢谢。
网上查过些资料,用起来不通.