exceptionresolver.java

来自「一个轻量级的MVC框架实例」· Java 代码 · 共 32 行

JAVA
32
字号
package com.javaeedev.lightweight.mvc;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;

/**
 * Interface of exception resolver to handle exception.
 * 
 * @author Xuefeng
 */
public interface ExceptionResolver {

    /**
     * Do init work when servlet starts.
     * 
     * @param context ServletContext object.
     * @throws ServletException If init failed.
     */
    void init(ServletContext context) throws ServletException;

    /**
     * When exception thrown during action's execution.
     * 
     * @param action Action object.
     * @param e Exception instance.
     * @return ModelAndView object after handle this exception, or null if 
     *         no exception page to display to user.
     */
    ModelAndView handleException(Action action, Exception e) throws Exception;

}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?