Java jsp文件上载位置
嗨,我正在使用Java jsp文件上载位置,java,eclipse,jsp,servlets,Java,Eclipse,Jsp,Servlets,嗨,我正在使用 String filePath = context.getRealPath("/")+"/Library/"; 所有图像都可以保存在中 .../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyProj/Library/ 当我在列表中列出文件时 .../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/w
String filePath = context.getRealPath("/")+"/Library/";
所有图像都可以保存在中
.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyProj/Library/
当我在列表中列出文件时
.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyProj/Library/
.../workspace/MyProj/Library/
从终端我可以看到上传的图像。但是如果我把文件列在
.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyProj/Library/
.../workspace/MyProj/Library/
我看不见他们。同样来自eclipse(在project explorer中)
我看不到上传的图像。然后我想那个位置可能是临时位置,于是重新启动了我的电脑。但上传的图片仍在使用中
.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyProj/Library/
但通过eclipse它们是不可见的,执行文件->刷新也没有帮助。我的问题如下上传的图片会留在这个位置吗
.../workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/MyProj/Library/
为什么我不能从日食中看到它们?如果可能的话,你能告诉我如何直接保存它们吗
.../workspace/MyProj/Library/
谢谢 您无法查看图像,因为eclipse已将您的webapp部署到服务器,并且您的图像正在上载到服务器 您可以使用以下命令将它们直接保存到工作区:
System.getEnv("user.home")+"/workspace/MyProj/Library/"
而不是:
context.getRealPath("/")+"/Library/";
这与Java、JSP或servlet有什么关系?这看起来像是一个Eclipse使用问题。