在参数设置时,会设置三个,包括:
1.File headImg; 2.String headImgContextType; 3.String headImgFileName;
其中headImg和headImgFileName都能够在UserAction中用到,但是headImgContextType却没有用到,但是为什么要设置呢?
带着这个疑问,我就将这个参数给注释掉了,发现会报以下警告,撤销后就没有了
ERROR [http-8080-2] ParametersInterceptor:34 - Developer Notification (set struts.devMode to false to disable this message):
Unexpected Exception caught setting
'headImgContentType'
on 'class cn.itcast.nsfw.user.action.UserAction
: Error
*****
'headImgContentType' with value
['image/png', ]
那么说明这个参数还是有用的,它在使用的时候,是经过了图片上传时某个参数调用,对其进行了传参,并取消掉,为什么说是取消掉,因为我在输出这个参数的值时始终是null;通过它传递上传图片的后缀格式,如果没有就不能设置。