Struts2版本2.0.x处理未知操作 [英] Struts2 Version 2.0.x handling unknown actions

查看:139
本文介绍了Struts2版本2.0.x处理未知操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在struts2版本2.1.x中,有一个新的UnknownHandler在请求到达时启动,并且找不到操作名称。

In struts2 version 2.1.x there is a new UnknownHandler that kicks in when a request arrives and the action name cannot be found.

问题是...如果存在于2.0.x版本中的是什么等效机制?

The question is...what is the equivalent mechanism if one exists in 2.0.x versions?

最近我注意到在检查日志文件时,当操作名称没有正确解决时会抛出异常,这实际上是导致一些问题。是否有应用程序广泛的设置来处理这个?

I recently noticed from examining the log files that exceptions are thrown when the action name is not properly resolved and this is actually causing some problems. Is there an application wide setting for handling this?

推荐答案

通配符默认值或动作默认值

Wildcard default or action default?

http://struts.apache.org/2.0.14/docs/ action-configuration.html#ActionConfiguration-WildcardMethod

<action name="*">
  <result>/{1}.jsp</result>
</action>

...

<package name="Hello" extends="action-default">

    <default-action-ref name="UnderConstruction">

    <action name="UnderConstruction">
        <result>/UnderConstruction.jsp</result>
    </action>

    ...

这篇关于Struts2版本2.0.x处理未知操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆