Answer the question
In order to leave comments, you need to log in
Spring how to pass value between controller methods?
recently with spring. don’t hit hard if it’s a very stupid question) I
add 2 variables to the model.
@GetMapping("/begin")
public String starter(Model model) {
........
model.addAttribute("citySet", setWords);
model.addAttribute("citySuggestedSystem", citySuggestedSystem);
....
return "begin";
}
@GetMapping("/next")
public String customerInputNewWorld(@RequestParam String word, Model model) {
@SuppressWarnings("unchecked")
HashSet<String> setWords= (HashSet<String>) model.getAttribute("citySet");
String citySuggestedSystem= (String) model.getAttribute("citySuggestedSystem");
.......
System.out.println(citySuggestedSystem);
.....
return "begin";
}
Answer the question
In order to leave comments, you need to log in
Hello!
Use SessionAttribute for this
https://stackoverflow.com/questions/37433863/how-t...
Yes. thank. line
@SessionAttributes({ "citySuggestedSystem", "citySet"}) solved my problem)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question