0
Struts的版本是2.3.16爲什麼struts.xml正確,但頁面是404?
在struts.xml
,我加入這個
<action name="ajaxuser" class="com.pp.ajax.UserAccount">
<result name="success">/out.jsp</result>
</action>
的XML和UserAccount
類是正確的,因爲有一定的要求,以這個網址是確定的,但有些要求是404
這是成功的請求
Request URL:http://localhost:8080/pp/ajaxuser
Request Method:POST
Status Code:200 OK
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate
Accept-Language:zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Content-Length:45
Content-Type:application/x-www-form-urlencoded; charset=UTF-8
Cookie:JSESSIONID=B6D15A95251B1477473BC524E7E9E148; Siggraph-Fontresizer=105; targetEncodinghttp://your-site=1; PHPSESSID=k2fi36gbn8979riffibp2mt1f7; _ga=GA1.1.2049659497.1410967472
Host:localhost:8080
Origin:http://localhost:8080
Referer:http://localhost:8080/pp/user-account
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
X-Requested-With:XMLHttpRequest
Form Dataview sourceview URL encoded
userId:2
username:b
password:b
oper:edit
id:8
Response Headersview source
Content-Length:5
Content-Type:text/html;charset=ISO-8859-1
Date:Thu, 25 Sep 2014 07:09:26 GMT
Server:Apache-Coyote/1.1
,這是失敗的請求
Remote Address:127.0.0.1:8080
Request URL:http://localhost:8080/pp/ajaxuser
Request Method:POST
Status Code:404 Not Found
Request Headersview source
Accept:*/*
Accept-Encoding:gzip,deflate
Accept-Language:zh-TW,zh;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Content-Length:55
Content-Type:application/x-www-form-urlencoded; charset=UTF-8
Cookie:JSESSIONID=B6D15A95251B1477473BC524E7E9E148; Siggraph-Fontresizer=105; targetEncodinghttp://your-site=1; PHPSESSID=k2fi36gbn8979riffibp2mt1f7; _ga=GA1.1.2049659497.1410967472
Host:localhost:8080
Origin:http://localhost:8080
Referer:http://localhost:8080/pp/user-account
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
X-Requested-With:XMLHttpRequest
Form Dataview sourceview URL encoded
userId:abc
username:abc
password:abc
oper:add
id:_empty
Response Headersview source
Content-Language:en
Content-Length:1089
Content-Type:text/html;charset=utf-8
Date:Thu, 25 Sep 2014 07:10:15 GMT
Server:Apache-Coyote/1.1
我看不出這兩個要求之間有什麼不同,所以我不明白爲什麼這個問題發生
我也是在開始的UserAccount
增加了斷點,但該方案不能達到這個斷點,服務器顯示此錯誤
WARNING: Could not find action or result: /pp/ajaxuser
No result defined for action com.pp.ajax.UserAccount and result input
我不知道如何追查這個問題,我現在該怎麼辦?
我在struts.xml中定義了動作和結果,它是正確的,但我仍然遇到這個錯誤。 – 2014-09-25 08:32:39
您的配置中沒有**輸入**結果。 – 2014-09-25 08:33:36
閱讀[這個答案](http://stackoverflow.com/a/25682007/1654265)。 – 2014-09-25 09:06:29