2011-02-11 45 views
0

我使用struts 1和urlwrite(http://www.tuckey.org/urlrewrite/),並且我有以下問題。我想改變一個動作的url,當這個新的url被調用時,這個動作應該被執行。這樣做是寫了下面的配置在urlrewrite.xml:Urlrewrite和struts動作

<rule> 
    <from>/users/create</from> 
    <to>%{context-path}/createUserAction\.do</to> 
</rule> 

<outbound-rule >  
    <from>/createUserAction\.do</from> 
    <to>/users/create</to>  
</outbound-rule> 

然後將HTML:鏈接prepareCreateUserAction,更改爲/用戶/創建。但是,它使用規則abve,但它會嘗試重定向操作名稱,而不使用.dohttp://localhost:8008/myapp/createUserAction而不是http://localhost:8008/myapp/createUserAction.do),並且未找到任何操作。

有誰知道如何解決這個問題?

回答

0

它看起來像這些規則,<to>不使用正則表達式,所以第一條規則實際上應該是:

<rule> 
    <from>/users/create</from> 
    <to>%{context-path}/createUserAction.do</to> 
</rule> 

換句話說,從之前。做刪除\