在action中
String path=ServletActionContext.getServletContext().getRealPath(uploadDir)
path总为null (uploadDir为保存文件的目录,在struts中进行了如下配置
<action name="edituserphoto" class="userPhotoAction" method="upload">
<interceptor-ref name="defaultStack" />
<result type="json">
<param name="ignoreHierarchy">false</param>
<param name="uploadDir">/userphotos</param>
</result>
</action>
求解