Passing parameters along with a multipart/form-data upload form (Java Http Post Upload)

前端 未结 3 859
再見小時候
再見小時候 2020-12-18 09:30

I have a code base which currently uploads file using Post and has enctype as multipart/form-data. Now I need to include some form items i.e. some parameters will also be pa

3条回答
  •  伪装坚强ぢ
    2020-12-18 09:32

    To send a parameter with a FileUpload it just needs to be added in the URL within the setAction method As follows:

    formPanel.setAction("<ProjectURL>/<YourServletName>?<YourParameterName>="+parameter);

    And in your servlet simply get the parameter as follows:

    req.getParameter("<YourParameterName>");

    Hope it helps ;-)

提交回复
热议问题