I am using Spring MVC RequestMapping here for GET parameters. Below is my code -
@RequestMapping(value = "index", method = RequestMethod.GET)
public HashMap<String, String> handleRequest(@RequestParam("dc1Servers") String dc1Servers) {
HashMap<String, String> model = new HashMap<String, String>();
String helloWorld = "Hello World!";
model.put("greeting", helloWorld);
System.out.println(dc1Servers);
return model;
}
I am hitting this URL - http://127.0.0.1:8080/dataweb/index?dc1Servers=7 then it goes into the above code and prints out 7 on the console and works fine.
Now I would like to have these two below parameters as well -
dc2Servers=7
dc3Servers=7
So I made a method like this which can take three input parameters -
@RequestMapping(value = "index", method = RequestMethod.GET)
public HashMap<String, String> handleRequest(@RequestParam("dc1Servers") String dc1Servers, @RequestParam("dc2Servers") String dc2Servers, @RequestParam("dc3Servers") String dc3Servers) {
HashMap<String, String> model = new HashMap<String, String>();
String helloWorld = "Hello World!";
model.put("greeting", helloWorld);
System.out.println(dc1Servers);
System.out.println(dc2Servers);
System.out.println(dc3Servers);
return model;
}
Now if I hit the url like this then it doesn't works -
http://127.0.0.1:8080/dataweb/index?dc1Servers=7?dc2Servers=7?dc3Servers=7
And it gives me some error.. Any idea what wrong I am doing here?