struts2文件拦截配置了interceptor,依然不能拦截其他格式文件?求大神解救

lflcode 2015-07-20 03:20:20
========struts.xml配置=============
<action name="UserAction_*" class="userAction" method="{1}">
<result name="loginUI">/WEB-INF/jsp/UserAction/loginUI.jsp</result>
<result name="login" type="chain">UserAction_warnRequest</result>
<result name="warnRequest">/WEB-INF/jsp/UserAction/adminmain.jsp</result>
<result name="list">/WEB-INF/jsp/UserAction/list.jsp</result>
<result name="toList" type="redirectAction">UserAction_list</result>
<result name="saveUI">/WEB-INF/jsp/UserAction/saveUI.jsp</result>
<interceptor-ref name="fileUpload">
<param name="fileUpload.maximumSize">600*1024</param>
<param name="fileUpload.allowType">image/jpg</param>
</interceptor-ref>
<interceptor-ref name="defaultStack" />

</action>
=========action上传代码=================
//文件上传保存
String realPath = "D:\\apache-tomcat-images\\sunhuas";
File file = new File(realPath);
if( !file.exists() ) file.mkdirs();
int i = userImageFileName.lastIndexOf(".");
String fileTypeName = userImageFileName.substring(i);
userImageFileName = new Date().getTime() + fileTypeName;
FileUtils.copyFile(userImage, new File(file,userImageFileName));
...全文
25 点赞 收藏 回复
写回复
回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2015-07-20 03:20
社区公告
暂无公告