error.jspjava.lang.Exception /WEB-INF/pages/error.jsp
<%@ page language="java" contentType="text/html; charset=EUC-KR" isErrorPage="true" pageEncoding="EUC-KR"%> <%@taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>HandlerExceptionResolver classInsert title here ${hello} This is an error page <%= exception %>
public class SnsHandlerExceptionResolver implements HandlerExceptionResolver @Override public ModelAndView resolveException(HttpServletRequest request, HttpServletResponse response, Object handler, Exception error) { if (request.getRequestURI().contains(".htm")) { request.setAttribute("javax.servlet.error.exception", error); request.setAttribute("hello", "hello"); final ModelAndView view = new ModelAndView(); return view; } }
If servlet Exception Occured this error.jsp page will called
No comments:
Post a Comment