-2

How to pass Hasmap from Html to Spring controller in java.And also I would like to know how to get it from the controller.

1 Answers1

0

First of all there is nothing like passing hashmap from html to Spring controller. What you want to accomplish is actually making a http request to web application.

Create a form model which has Map<String,String> as class variable with appropriate setter and getter.

Then in your action;

  public @ResponseBody String formPost(@ModelAttribute YourFormClass form, HttpServletRequest request) {
      //Rest of your business logic
  }
Fatih Donmez
  • 4,221
  • 2
  • 31
  • 45