System.getProperty("user.dir")【不同位置调用,获取的路径是动态变化的】
2、获取本地路径
jsp中,<html:file property="myFile"/>
request.getParameter("myFile");
ActionForm.getMyFile();
获取的值相同:如D:\VSS安装目录\users.txt
*********************************
this.getClass().getClassLoader().getResource("").getPath();
==/D:/workspace/strutsTest/WebRoot/WEB-INF/classes/
this.getClass().getResource("").getPath().toString();
==/D:/workspace/strutsTest/WebRoot/WEB-INF/classes/bl/
3、获取相对路径
request.getContextPath();
如:/strutsTest