I am wondering how to return HTML or JSON to the same method depending on the logic in the Spring controller method. I did it in .NET, just need to know how to do it in Spring.
UserModel user = new UserModel();
user.setFirstName("Michael");
user.setLastName("Flynn");
model.getList().add(user);
model.setSearchTerm("test");
if(true)
{
return new ModelAndView("controls/tables/users", "model", model);
}
else
return model;
source
share