포트폴리오/SPRINGBOOT 옛날

2-08 : redirecting to ROOT URL

서버관리자 페페 2022. 10. 1. 16:48

단 하나의 맥락

: 메인페이지

 

-

 

Semiflow Bundle

- @RequestMapping("/") 어노테이션으로 루트 URL을 매핑한다

- public String root() 메소드에 return "redirect:/question/list"; 로 리다이렉팅한다

 

-

 

package com.mysite.sbb;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class MainController {

    @RequestMapping("/sbb")
    @ResponseBody
    public String index() {
        return "안녕하세요 sbb에 오신것을 환영합니다.";
    }

    @RequestMapping("/")
    public String root() {
        return "redirect:/question/list";
    }
}

 

'포트폴리오 > SPRINGBOOT 옛날' 카테고리의 다른 글

2-10 : 질문 리스트 > 질문 상세  (1) 2022.10.01
2-09 : Service  (4) 2022.10.01
2-07 : template  (3) 2022.09.30
2-05 : repository  (6) 2022.09.29
2-04 : Entity  (4) 2022.09.27