關於Struts2中的錯誤:例如There is no Action mapped for namespace / and action name product-input.

來源:互聯網
上載者:User

標籤:設定檔   action   package   空間   命名   

   

        在配置struts.xml 檔案時,會出現  

 There is no Action mapped for namespace / and action name ....    意思是沒有product-input的對應檔或者是命名空間

      出現這樣的錯誤的原因後:

    做如下檢查:  

        1: 把struts.xml中的namespace="/"改成namespace=""或者去除,使用預設的命名空間。 

         2: struts.xml設定檔的位置,是否在src下。

         3: struts.xml的拼字是否正確

         4: package中的 name="struts2"建議struts2改成別的名字,這樣容易引起衝突

    檢查好以上的步驟之後,還是 There is no Action mapped for namespace / and action name .... 這樣的錯誤。那麼就要檢查編譯後的struts.xml檔案是否在WEB-INF目錄下

  有些IDE預設編譯後檔案的存放目錄是在build下,這樣子找不到struts.xml,報如上的錯誤也是正常的


      

關於更改eclipse Web 專案預設編譯輸出路徑:

        eclipse中只能針對項目更改,因為其預設的是build目錄下的,只能以項目更改項目右鍵 -》properties -》Java Build Path -》source -》Default output folder,選擇

    還有一種更方便的。因為出現這種錯誤往往是最開始的時候,可以重新建立個項目。好處很多:最重要的一點是在更改預設編譯輸出路徑時可能會檔案丟失的情況。

            更改方法如下:

650) this.width=650;" src="http://s1.51cto.com/wyfs02/M00/7A/D6/wKiom1a8shSz9SC5AADIBRDzapQ291.png" style="float:none;" title="QQ20160212000734.png" alt="wKiom1a8shSz9SC5AADIBRDzapQ291.png" />

650) this.width=650;" src="http://s5.51cto.com/wyfs02/M01/7A/D6/wKiom1a8shXjggomAADQaLdOGSo935.png" style="float:none;" title="QQ20160212000751.png" alt="wKiom1a8shXjggomAADQaLdOGSo935.png" />

第一張圖是預設情況下的設定,第二張圖是我修改後的。



就是這樣子。。有啥問題可以給我留言,謝謝

        


 




本文出自 “青瓷領” 部落格,請務必保留此出處http://9849113.blog.51cto.com/9839113/1741575

關於Struts2中的錯誤:例如There is no Action mapped for namespace / and action name product-input.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.