I have in front end a form where the user selects the year and one or more months from a list of months. These params will be sent to Controller as Get Method. Given an URL like this:
..../{year}/{months}/excel/
Where months would be a variable list of the months selected, i.e [01,02,10].
How I receive all parameters in the Controller? Here's my controller so far:
@RequestMapping(value = "/{year}/{months}/excel/", method = RequestMethod.GET, produces = EXCEL_FORMAT_HEADER)
public @ResponseBody
ModelAndView getRankingByYearExcel(@PathVariable("year") Integer year,
@RequestParam Map<String, Object> months)
{...}
I did it like this and worked, declaring months as array of Strings:
@RequestMapping(value = "/{year}/excel/", method = RequestMethod.GET, produces = EXCEL_FORMAT_HEADER)
public @ResponseBody
ModelAndView getRankingByYearExcel(@PathVariable("year") Integer year,
@RequestParam String[] months)
And in URL sent variable months as array of strings:
../2016/excel/?months=1,3,12
Thanks for guiding me in this direction
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With