Uploading image using Struts

前端 未结 3 1465
梦如初夏
梦如初夏 2021-01-27 09:08

I just started practicing struts, so I\'m kinda new to this framework. So, what I\'m trying to do is upload an image using this JSP file :



        
3条回答
  •  遥遥无期
    2021-01-27 09:48

    You can start with simple file upload example then you can see where the uploaded file is stored. If you get the uploaded file name is set you can copy file. You can prevent null pointer exception before you start saving.

    if (myFileFileName != null)
      InsertImage.save(this);  
    

    You can also add required validator that will check the field value before your action is executed.

提交回复
热议问题