SampleController.java
페이지 정보
작성자 관리자 작성일 24-06-04 12:03 조회 135 댓글 0본문
package web.controller;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import lombok.extern.log4j.Log4j2;
@Controller
@Log4j2
public class SampleController {
@GetMapping("/hello")
public void index(Model model) {
log.info("hello..................");
model.addAttribute("msg", "Hello 하이~");
List<String> list = Arrays.asList("aa","bb","cc","dd");
model.addAttribute("list", list);
}
@GetMapping("ex01")
public void ex01(Model model) {
log.info("ex01..................");
List<String> list = Arrays.asList("aa","bb","cc","dd");
SampleDTO dto = new SampleDTO();
dto.setId("abcd");
dto.setPass("1234");
dto.setName("홍길동");
Map<String, String> map = new HashMap<>();
map.put("A", "aaa");
map.put("B", "bbb");
model.addAttribute("list", list);
model.addAttribute("dto", dto);
model.addAttribute("map", map);
}
}
댓글목록 0
등록된 댓글이 없습니다.