From bb55273e0dcb1a16cfc633b72653ce884f1eb43b Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Tue, 26 Dec 2023 17:27:48 +0900 Subject: [PATCH] =?UTF-8?q?=EC=98=A4=EB=A5=98=20=EC=8B=9C=20errorPage=20?= =?UTF-8?q?=EC=9C=A0=EB=AC=B4=EC=97=90=20=EB=8C=80=ED=95=9C=20viewName=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cokr/xit/foundation/web/ExceptionController.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/cokr/xit/foundation/web/ExceptionController.java b/src/main/java/cokr/xit/foundation/web/ExceptionController.java index 4ea97ac..def21a2 100644 --- a/src/main/java/cokr/xit/foundation/web/ExceptionController.java +++ b/src/main/java/cokr/xit/foundation/web/ExceptionController.java @@ -29,13 +29,14 @@ public class ExceptionController extends AbstractController { } protected ModelAndView toErrorPage(HttpServletRequest hreq, Object status, String msgKey) { - return new ModelAndView("error/errorPage") + Object disp = hreq.getRequestDispatcher("error/errorPage"); + String viewName = disp != null ? "error/errorPage" : "jsonView" ; + return new ModelAndView(viewName) .addObject("json", ajaxRequest() || jsonResponse()) .addObject("path", getAction(hreq)) .addObject("failed", true) .addObject("status", status) - .addObject("message", message(msgKey)) - ; + .addObject("message", message(msgKey)); } /**pageNotFound 오류의 처리를 위한 정보를 갖는 ModelAndView를 반환한다.