Struts 2のアクション接尾辞拡張を削除する方法

Struts 2でアクションサフィックスの拡張子を削除する方法

ダウンロード–Struts2-Custom-Extension-Example.zip

Struts 2では、すべてのアクションクラスにデフォルトのsuffix .action extensionがあります。 例えば、


  
    
        pages/printStruts2.jsp
    
  

「SayStruts2」アクションクラスにアクセスするには、次のURLを使用します。

Action URL : http://localhost:8080/Struts2Example/SayStruts2.action

アクション拡張機能を構成する

Struts 2を使用すると、アクション拡張機能を簡単に構成でき、変更するには、定数「struts.action.extension」値を宣言するだけです。

1. html拡張

アクションクラスを.html拡張子に変更します。



  

  
    
        pages/printStruts2.jsp
    
  

これで、「S Struts2」アクションクラスにアクセスできます。

Action URL : http://localhost:8080/Struts2Example/SayStruts2.html

2. 延長なし

アクションクラスを空の拡張子に変更します。



  

  
    
        pages/printStruts2.jsp
    
  

これで、「SayStruts2」アクションクラスにアクセスできます。

Action URL : http://localhost:8080/Struts2Example/SayStruts2