<body>
<html:form action="/jwid/struts1x/15.3/form/upload.do?action=upload" enctype="multipart/form-data">
文件:<html:file property="file" style="width:200px;"></html:file><br>
备注:<html:textarea property="text" style="width:200px;"></html:textarea><br><br>
<html:submit value="开始上传"></html:submit>
</html:form>
</body>
上传到/WEB-INF/upload之后,文件名是乱码
解决办法:UploadForm.reset()中添加代码:
try {
request.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
简单的MVC:UploadForm、UploadAction、upload.jsp
struts使用html:file上传文件的时候文件名乱码解决,布布扣,bubuko.com
时间: 2024-12-04 12:05:23