java 无法找到“struts.multipart.saveDir”属性设置。默认为 javax.servlet.context.tempdir

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7297936/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 19:27:07  来源:igfitidea点击:

Unable to find 'struts.multipart.saveDir' property setting. Defaulting to javax.servlet.context.tempdir

javajspfile-uploadstruts2

提问by xrcwrn

While trying to upload the Image in struts2 the image is not uploading and showing following msg Unable to find struts.multipart.saveDirproperty setting. Defaulting to javax.servlet.context.tempdir

尝试在 struts2 中上传图像时,图像未上传并显示以下消息无法找到struts.multipart.saveDir属性设置。默认为javax.servlet.context.tempdir

How to solve this problem

如何解决这个问题呢

回答by Umesh Awasthi

Can you show the code which you are using as that will always be helpful. you need to specify

你能展示你正在使用的代码吗,因为这总是有帮助的。你需要指定

struts.multipart.saveDir=

property in either struts.xml file as a constant entry or you need to specify that in struts.properties file choice is all yours.

属性在 struts.xml 文件中作为常量条目,或者您需要在 struts.properties 文件中指定选择是您的全部。

struts.multipart.saveDir - The directory where the uploaded files will be placed. If this property is not set it defaults to javax.servlet.context.tempdir.

this is the case with your post since you have not specified the location by yourself so struts2 is picking up the temp location for file upload.

你的帖子就是这种情况,因为你没有自己指定位置,所以 struts2 正在选择文件上传的临时位置。

here is the link defining the details File Upload

这是定义详细信息文件上传的链接

editin struts.xml

编辑struts.xml

<struts>
    <constant name="struts.multipart.saveDir" value="location of your choice" />
    ...
</struts>

PS:Your acceptance rate seems low/not defined.In order to get help its always advised to accept answer if it helps you to solve your problem

PS:你的接受率似乎很低/没有定义。为了得到帮助,如果它可以帮助你解决你的问题,它总是建议接受答案