Y
Y
Yourmind2019-09-13 10:37:14
Java
Yourmind, 2019-09-13 10:37:14

What is the best way to output to the controller in spring boot?

Is there a difference between the output of the controller in these 2 options, and if so, which is better and why?
1:
@GetMapping("/home")
public String mydogs( Map model) { model.
put("some","hello");
return "mydogs";
}
2:
@GetMapping("/home")
public String mydogs(Model model) {
model.addAttribute("some", "hello");
return "mydogs";
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question