• struts2 异常跳转页面配置


    在struts.xml中配置了异常跳转,

        <package name="default" namespace="/" extends="struts-default">
            <global-results>
                <result name="exception-error">/error/exception.jsp</result>
            </global-results>
            <global-exception-mappings>
                <exception-mapping result="exception-error" exception="java.lang.Exception"></exception-mapping>
            </global-exception-mappings>    
        </package>

    其他的action都继承default。

    但是,当url输错的时候,页面依然会出现很多异常信息,并没有按照预期跳转至编写的exception错误提示页。

    纠结了一阵子后,发现是这里的问题:struts.xml中的配置:

        <!--开发模式下使用,这样可以打印出更详细的错误信息-->
        <constant name="struts.devMode" value="true" />

        将true改为false,

        美妙的异常提示页面,出现了!

  • 相关阅读:
    020-请你说一说app测试的工具
    栈的压入、弹出序列
    包含min函数的栈
    顺时针打印矩阵
    二叉树的镜像
    树的子结构
    链表中倒数第k个结点
    调整数组顺序使奇数位于偶数前面
    数值的整数次方
    矩形覆盖
  • 原文地址:https://www.cnblogs.com/lbangel/p/3096982.html
Copyright © 2020-2023  润新知