There is no Action mapped for namespace / and action name UserAction

果斷收藏了,說的很詳細。初學者經常遇到的問題。

There is no Action mapped for namespace / and action name UserAction

在網上找了好久才找解到的方法,其實是因爲我的struts.xml文件放錯了位置,服務器沒有加載上導制。

之後將struts.xml文件移到src目錄下就可以了。teeth_smile.gif

將自己在網上的搜到的解決方案貼在這裏供網友們以後解決問題的時候參考。

可能的原因:
1.-----首先查看你的struts.xml 文件是否在src目錄下;
2.-----檢查struts.xml文件的語法是否正確: 如果1正確的話那就一定是struts.xml文件的問題: <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<package name="struts2" extends="struts-default">

<action name="login" class="com.test.action.LoginAction">
<result name="success">/result.jsp</result>
</action>
</package>
</struts>
那麼就只有是紅字的部分寫錯了 查看你的是否吧struts-default中間的“-”錯寫成了struts=default;

二.確定名稱是 struts.xml
三.粗心,仔細檢查配置文件,和excute方法的代碼


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章