Document of Spring Boot Model Manual
Model addAttribute(Object attributeValue)
Add the supplied attribute to this Map using a generated name.
Example
ArrayList<User> listOfArray = new ArrayList<User>();
userAiven ua = new userAiven();
listOfArray = ua.userAivenList();
model.addAttribute("listOfArray", listOfArray);
//this to assign Controller
@Controller
public class SongListController {
@GetMapping("/songlist")
public String songlist(Model model){
ArrayList<Song> songList = new ArrayList<Song>();
songAiven sa = new songAiven();
songList = sa.songAivenList();
model.addAttribute("ListOfSong", songList);
//data to View is ${ListOfSong}
//return view is songList
return "songlist";
}
}