Struts 版本是 2.3.16
在struts.xml
,我添加了这个
<action name="ajaxuser" class="com.pp.ajax.UserAccount">
<result name="success">/out.jsp</result>
</action>
xml 和UserAccount
类是正确的,因为对这个 url 的一些请求是可以的,但是一些请求是 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
我不知道如何追踪这个问题,我现在该怎么办?