1. 程式人生 > >解決There is no Action mapped for namespace [/] and action name [userAction!add]等問題

解決There is no Action mapped for namespace [/] and action name [userAction!add]等問題

      今天初步學了一下Struct2的Action物件,在接近完成的時候,總是出現There is no Action mapped for namespace [/] and action name [userAction!add]的這個錯誤,排除了網上所說的(1)檔名拼寫是否正確(2)URL地址是否正確(3)struts.xml放在了src資料夾下(4)struts.xml檔案編寫沒有錯誤等等因素之後,如果你也是這樣的情況的話,恭喜你,看到我的部落格並按照我下面的極其簡單的操作有百分之八十五以上的可能性即可解決此問題。(溫馨提示:不想知道造成原因只想解決的問題朋友之間看最後面即可)得意

先來解釋一下原因:

我使用的是struts2的2.3和2.5版本,這些問題也可能會在更高的版本中出現,造成這個問題的主要原因是DMI所致。

解釋一下何為DMI

  所謂DMI:是Struts 2提供了這種包含多個處理邏輯的Action 處理方式,英文全稱Dynamic Method Invocation,也叫作動態方法呼叫。通過動態請求Action 物件中的方法,可以實現對某一業務邏輯的處理。

那麼DMI的處理方式有是如何呢?  

       DMI 處理方式是通過請求Action 物件中的一個具體的方法來實現動態的操作。具體說就是,在請求Action 的URL 地址後加上請求方法字串,與Action 物件中的方法進行匹配。其中,Action 物件名稱和方法之間用“!”隔開。即如果在struts.xml 檔案中配置了名為userAction的Action ,為了請求add() 方法,請求方式應表示為“userAction!add ”。

那麼DMI是如何造成此問題的呢?

       是因為官方在釋出版本的時候把DMI預設是關閉的!(這種東西不調查要上哪裡知道去啊驚訝

接下來言歸正傳!解決方法就是需要在struts.xml中加一句!(注意一下,得是在<struts></struts>裡面加不然會報錯哦~)


<constant name="struts.enable.DynamicMethodInvocation" value="true" /> 來開啟動態方法呼叫。

接下來在即可進行動態呼叫,一切問題也都可以解決了!

相關推薦

解決 struts2 報"There is no Action mapped for namespace / and action name"的問題

https def col demo 解決 ack ges 裏的 dex 在配置struts2 入門demo時碰到"There is no Action mapped for namespace / and action name"問題,查了一些資料,但沒有完全解決問題,

There is no Action mapped for namespace [/] and action name... associated with解決方法

出現這個錯誤,說明action沒有找到,這時就需要考慮struts.xml配置檔案是否配置無誤,經過再三確認,檔案裡面沒出錯,是struts.xml名字錯了,寫成了structs.xml,多了個c,修改後,問題得以解決!

解決There is no Action mapped for namespace [/] and action name [userAction!add]問題

      今天初步學了一下Struct2的Action物件,在接近完成的時候,總是出現There is no Action mapped for namespace [/] and action name [userAction!add]的這個錯誤,排除了網上所說的(1)檔

There is no Action mapped for namespace [/] and action name [Login] associated

pat rop back 圖片 src 兩個 ont person 大小 使用struts2時出現了: There is no Action mapped for namespace [/] and action name [Login] associated 兩個可能的

【bug】使用spring+struts2註解開發,提示” There is no Action mapped for namespace [/] and action name [xxxxx.action] associated with context path []”

there 提示 就是 技術分享 文件夾路徑 iat class bubuko ring 使用註解開發,通過spring管理struts2容器,配置文件沒有問題,前臺路徑無誤 錯誤提示: There is no Action mapped for namespace [/]

HTTP Status 404 - There is no Action mapped for namespace [/] and action name [courseTypeAction_find

HTTP Status 404 - There is no Action mapped for namespace [/] and action name [courseTypeAction_findAll] associated with context path [/crm]. 原因:不同的

There is no Action mapped for namespace [/] and action name [test] associated with context path [...

There is no Action mapped for namespace [/] and action name [test] associated with context path [/s2d]. - [unknown location] stucts2中錯誤

SpringBoot2.x整合Security5(完美解決 There is no PasswordEncoder mapped for the id "null")

問題描述 以前做過一次SpringBoot整合Security的專案,但最近重新嘗試SpringBoot整合Security的專案時卻碰到了問題 java.lang.IllegalArgumentException: There is no PasswordEn

java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null"

今天在配置spring-security.xml配置檔案時出錯 錯誤如下: 嚴重: Servlet.service() for servlet [security] in context with path [] threw exception java.lang.IllegalArgumentExcept

Spring Security 無法登陸,報錯:There is no PasswordEncoder mapped for the id “null”

編寫好繼承了WebSecurityConfigurerAdapter類的WebSecurityConfig類後,我們需要在configure(AuthenticationManagerBuilder auth) 方法中定義認證用於資訊獲取來源以及密碼校驗規則等。(config

Springboot Security記憶體驗證無法登陸,There is no PasswordEncoder mapped for the id "null"

Security進行記憶體驗證使用者的時候,程式碼是這麼寫的 auth.inMemoryAuthentication().withUser("demo").password("demo").roles("USER");//使用者角色 auth.inMemoryAuthenticati

SpringBoot2.x整合Spring Security5,登陸報錯:There is no PasswordEncoder mapped for the id "null"

解決: 在繼承了WebSecurityConfigurerAdapter的自定義類SecurityConfig上新增一個BCryptPasswordEncoder型別的PasswordEncoder 元件: @EnableWebSecurity //@EnableWeb

java.lang.IllegalArgumentException: There is no PasswordEncoder mapped for the id "null"

在學習SpringBoot整合SpringSecurity的時候,做簡單認證的時候出現這種錯誤。 是因為,在 進行認證的時候我自定義的認證UserDetailsService 的密碼沒有進行加密,所以 才會出現這種情況。新增以下方法即可: @Bean

Spring Security 報There is no PasswordEncoder mapped for the id "null"

encode row The autowired auto ppa params isp span 查了下發現是spring security 版本在5.0後就要加個PasswordEncoder了 解決辦法 在securityConfig類下加入NoOpP

Struts報ERROR Dispatcher Could not find action or result: / There is no Action mapped for namespace..

Struts出現ERROR Dispatcher Could not find action or result: / There is no Action mapped for namespace [/] and action name [] associated with context pat

"There is no tracking information for the current branch" 解決方法

col pan gin ranch eas code pre 解決方法 git 因為新創建的分支push到遠程倉庫後沒有與本地分支關聯,下面語句可以令遠程分支與本地分支關聯起來 git branch --set-upstream-to=origin/release_3

mybatis加Spring專案: 解決There is no getter for property named '***' in 'class java.lang.String'問題

使用mybatis對映mysql資料庫時,傳入引數為'status',執行報錯為:There is no getter for property named 'status' in 'class java.lang.String 使用'#'作為mybatis的對映標識執行可

【MyBatis學習06】_parameter:解決There is no getter for property named in class java.lang.String

我們知道在mybatis的對映中傳引數,只能傳入一個。通過#{引數名} 即可獲取傳入的值。 Mapper介面檔案: public int delete(int id) throws Exception; MapperL配置檔案: <dele

mybatis there is no getter named for"Integer"

一:發現問題 sql動態語句中如果 parameterType="int"     <select id="sel_campusinfo" parameterType="int" resultType="Campusinfo">  &n

Git: There is no tracking information for the current branch.

在執行git pull的時候,提示當前branch沒有跟蹤資訊: git pull There is no tracking information for the current branch. Please specify which branch you