码迷,mamicode.com
首页 > Web开发 > 详细

web.xml 404 500 配置

时间:2016-08-06 09:50:10      阅读:198      评论:0      收藏:0      [点我收藏+]

标签:

web.xml

    <error-page>
        <error-code>404</error-code>
        <location>/error404.html</location>
    </error-page>

    <error-page>
        <error-code>500</error-code>
        <location>/error500.html</location>
    </error-page>

 

 

controller.java

    /**
     * 404
     */
    @RequestMapping(value = "/error404.html")
    public String error404(Model model, HttpServletRequest request) {
        return "/jsp/common/error404";
    }
    
    /**
     * 500
     */
    @RequestMapping(value = "/error500.html")
    public String error500(Model model, HttpServletRequest request) {
        return "/jsp/common/error500";
    }

 

 

spring mvc 

    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/views/" />
        <property name="suffix" value=".jsp" />
    </bean>

 

tree /F

└─WEB-INF
   │  web.xml
   │
   └─views
       └─jsp
           │
           ├─common
           │      error404.jsp
           │      error500.jsp
           │

 

web.xml 404 500 配置

标签:

原文地址:http://www.cnblogs.com/zno2/p/5323152.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!