-
카테고리
-
세부 분야
백엔드
-
해결 여부
미해결
whitepage에러 질문드립니다
21.07.21 17:26 작성 조회수 137
0
package mvcStructure.basic.request;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Slf4j
@Controller
public class RequestParamController {
@RequestMapping("/request-param-v1")
public void requestParamV1(HttpServletRequest request, HttpServletResponse response) throws IOException {
String username = request.getParameter("username");
int age = Integer.parseInt(request.getParameter("age"));
response.getWriter().write("ok");
}
@ResponseBody
@RequestMapping("/request-param-v3")
public String requestParamV3(@RequestParam String username,
@RequestParam String age){
log.info("username = {}, age = {}", username, age);
return "ok";
}
//@RequestParam 생략하고 단순 타입이면 자동으로 RequestParam이라고 요청 파라미터라고 인식한다
@ResponseBody
@RequestMapping("/request-param-v4")
public String requestParamV34( String username, String age){
log.info("username = {}, age = {}", username, age);
return "ok";
}
@ResponseBody
@RequestMapping("/request-param-Required")
public String requestParamRequired(
@RequestParam(required = true) String username,
@RequestParam(required = false) Integer age){
log.info("username = {}, age = {}", username, age);
return "ok";
}
}
현재소스이고 경로는 아래와 같이 했습닌다
===========================================
properties속성은 아래와 같습니다
============================
#mvcStructure.~~ 패키지와 그 하위 로그레벨 설정
logging.level.root=info
logging.level.hello.springmvc=debug
==============================
현재 접속하면 whitepage가 나는건 왜그런가요
답변을 작성해보세요.
답변 1