package com.songzihao.springboot.controller;
import com.songzihao.springboot.model.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Controller
public class UserController {
@RequestMapping(value = "/each/array")
public String eachArray(Model model) {
User[] userArray = new User[10];
for (int i = 0; i < 10; i++) {
User user = new User();
user.setId(i);
user.setName("宋小" + i);
user.setPhone("1853790565" + i);
user.setAddress("洛阳市涧西区XX路" + i + "号");
userArray[i] = user;
model.addAttribute("userArray",userArray);
return "eachArray";
}