2009-05-20 46 views
0

在struts2 2.1.x版中有一個新的UnknownHandler,當請求到達並且無法找到動作名稱時會啓動。Struts2 2.0.x版處理未知動作

問題是...如果存在2.0.x版本,等效機制是什麼?

我最近從檢查日誌文件中注意到,當操作名稱沒有正確解析時,拋出異常,這實際上導致了一些問題。是否有應用程序廣泛的設置來處理這個問題?

回答

1

通配符默認或動作默認?

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> 

    ... 
+0

奇怪怎麼沒有在wiki上或谷歌搜索量止跌回升該頁面。感謝指針。 – 2009-05-20 19:15:36