我想把Struts 2上传文件的目的地下的WebContent
我的应用程序。
我已经使用了这个方法:
ServletContext context = ServletActionContext.getServletContext();
String uploadFilePath = context.getRealPath("/uploads");
字符串
但是uploadFilePath
返回这个
D:\dev\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\MyApplication\uploads
型
我想得到这个返回值
D:\dev\workspace\MyApplication\WebContent\uploads
型
如何在WebContent
下放置Struts2上传文件目的地。我使用Eclipse Juno和Windows7。
2条答案
按热度按时间hivapdat1#
试试这个
字符串
hmtdttj42#
Struts 2将上载文件放置在为Web服务器指定 * 临时 * 文件夹下您可以将此文件夹中文件复制到收藏夹中
字符串
请参阅Java tutorial。