1.鼠标选中项目,右击菜单,选择 properties
2.出来弹出框,选择resource,location 的值就是你想要的项目绝对路径
点击项目,右键,属性,就可以看到“位置”,就是绝对路径了。
想要获取 ROOT 是么?
这个你使用application就行啊。request.getSession().getServletContext().getRealPath();
a String
specifying the real path,
* or null if the translation cannot be performed
这个就是 getRealPath() 的注释。
你可以在类里面定义一个变量,用来保存路径,这个路径可以自己拼成的,然后再在页面读取
项目右键,属性就能看见了