Skip to content

nglthu1979/springBoot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

springBoot

Model

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);

Controller

//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";

    }

    
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •