Struts version is 2.3.16
In struts.xml
, I added this
<action name="ajaxuser" class="com.pp.ajax.UserAccount">
<result name="success">/out.jsp</result>
</action>
the xml and the UserAccount
class are correct, because some request to this url is OK, but some request is 404.
This is the successful request
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
And this is the failed request
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
I cannot see any different between these two request, so I don't understand why this problem occurred
I also added a breakpoint at the begin of UserAccount
, but the program cannot reach this breakpoint, and server show this error
WARNING: Could not find action or result: /pp/ajaxuser
No result defined for action com.pp.ajax.UserAccount and result input
I have no idea how to trace this problem, what can I do now?