Announcement Announcement Module
Collapse
No announcement yet.
[Spring MVC] : Submit form with multipart with file and fields Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • [Spring MVC] : Submit form with multipart with file and fields

    Hi at all

    This is my "problem" : I have a form mapped on this method :
    Code:
    @ActionMapping(value = "aggiungiApplicazione")
    	public void aggiungiApplicazione(@ModelAttribute("applicazioneForm") ApplicazioneForm applicazioneForm,BindingResult bindingResult,ActionRequest request, ActionResponse response,SessionStatus sessionStatus) {
    For now all is ok. But if I set at my form this
    Code:
     enctype="multipart/form-data"
    (because I need to upload a file...) , the mapping on applicazioneForm didn't work.

    (I found a workaround, processing directly the request, but I'm sure that there is a method to do what I want..)

    Now, how can solve this?

    Thanks in advance...

    Giggi

  • #2
    hi,
    In Spring MVC you can use the following parameter in the controller method to map a file upload in the form:

    Code:
    @RequestParam CommonsMultipartFile fileUpload
    Here's a reference:

    Upload files with Spring MVC

    Comment

    Working...
    X