How to define a global page when requested page or method is not found?

后端 未结 2 2048
执笔经年
执笔经年 2020-12-11 11:40

I know how to fine a global error redirect page in our defined package when exception encountered that just by adding the following configuration in the parent package in

相关标签:
2条回答
  • 2020-12-11 12:29

    You should define your unknown handler in the struts.xml. Unknown handlers are called by the framework, when an unknown action, result, or method are executed.

    <bean type="com.opensymphony.xwork2.UnknownHandler" name="handler" class="com.package.SomeUnknownHandler"/> 
    

    The class should implement UknownHandler interface to handle the cases:

    • when an action configuration is unknown
    • when a result cannot be found for an action and result code
    • when an action method cannot be found
    0 讨论(0)
  • 2020-12-11 12:35

    Here some detaiks a how you can use the UknownHandler (https://stackoverflow.com/a/27881698/3383543), enjoy.

    0 讨论(0)
提交回复
热议问题