스프링 MVC를 처음 사용했습니다. 예외를 잡는 contoller, error.jsp 페이지로 리디렉션하고 예외 메시지 (ex.getMessage()) 표시하려는 예외를 catch 한 후했습니다. Spring의 Exception Handler를 사용하지 않고 error.jsp로 프로그래밍 방식으로 리디렉션해야합니다.스프링 MVC 컨트롤러에서 Jsp 페이지 호출하기
@RequestMapping(value = "http/exception", method = RequestMethod.GET)
public String exception2()
{
try{
generateException();
}catch(IndexOutOfBoundsException e){
handleException();
}
return "";
}
private void generateException(){
throw new IndexOutOfBoundsException();
}
private void handleException(){
// what should go here to redirect the page to error.jsp
}
감사 에드워드. 네가 옳아. 그것은 문자열이 아니어야 하고이 approch 작동합니다. 귀하의 회신에 감사드립니다. – james01