How to catch the exception thrown by default interceptor's stack in Struts 2? [closed]

大城市里の小女人 提交于 2019-11-29 18:28:02

The exception is thrown because URL used with the request is not properly mapped to the action configuration. To get rid of the exception you should properly map URL to the action or use default action reference which will be called if no action found for the given URL.

You may also use wildcard mapping to map a bunch of URLs even with regex pattern matcher which will find your action or if it doesn't help to override the default behavior of the action mapper by supplying your custom implementation.

To handle exceptions form your action code you can use the exception interceptor on the stack of your action. It will help you what kind of exceptions you want to handle via global exception mapping and define the global results that will actually handle the exception. See the link that explains more in details and examples how to make the default package with exception handling.

There's an option to extend the interceptor and override the exception handling mechanism as also described in the docs.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!