0

I want to send a picture to another page and see what happen
but when I put

@RequestParam Map map

it can not find the local page.

<form id = "myForm" action ="/submit_page"  method="POST" enctype="multipart/form-data">
                        input class="uploadName" value="" disabled="disabled">
                                        <label for="fileFind">find file</label> 

                     <input type="button" onclick="myFunction()" value="Submit form">
</form>

and I supposed to get this file with /submit_page

@RequestMapping("/submit_page")
    public ModelAndView submit_page(@RequestParam Map map ){
        ModelAndView mav = new ModelAndView();
        mav.setViewName("submit");


        return mav;

    }

with out @requestparam Map map it find the page

kong kim
  • 29
  • 1
  • 4

1 Answers1

0

@RequestParam

Means that when you make a call to the server side you must have the parameter (The explanation in your case is that you did not set the header with a request parameters named map) Example:

@RequestParam(value="param1", required=true) String param1)

If this header is not exist will throw I suppose a bad request or something like that...

@PathVariable

In another scenario if you would like to receive a path parameters from the URL for example: http://localhost:8082/something/{id} you must use the next line in the header of the method:

@PathVariable(value="id") String id)
RazvanParautiu
  • 2,805
  • 2
  • 18
  • 21