I am pretty new to Spring, so sorry if this question may appear rather easy or obvious, but I was trying to look for an answer to this bus wasn't able to find it. So my question is how to use multiple SessionAttributes and get them into the map in one method?
i.e. I have a @Controller which uses SessionAttributes:
@Controller
@SessionAttributes({"name", "lastName", "birthDate"})
public class SearchController {
@RequestMapping(value = "/your-relatives")
public String findRelatives(ModelMap model) {
String name = (String) model.get("name");
String lastName = (String) model.get("lastName");
String birthDate = (String) model.get("birthDate");
if (name.equals("John") && lastName.equals("Johnny")) {
return "YES";
}
return "NO";
}
}
But when I am trying to return "YES" in case when if is true, I get the error - There was an unexpected error (type=Internal Server Error, status=500). No message available
It only works when using just one of attributes.
Aucun commentaire:
Enregistrer un commentaire