Struts2-No result defined for action and result Input

Source: Internet
Author: User

No result defined for action and result Input

During programming today, I encountered the error "no result defined for action and result input". I am sure you have encountered this error. I have sent this error for a long time today, I thought my action function went wrong and wanted to debug it,ProgramJust do not go to the breakpoint, check the information online, some say the path is wrong, and then I am looking for my path error. After half a day, I still did not find the path problem. Then, the get methods of the attributes I gave me are all broken points. I found the problem and want to share it with you now.
This error is not defined for the returned input, but sometimes we do not need this ghost thing. However, if an error occurs in the action, the input is returned by default, if we define it in struts <result>, the error "no result defined for action and result input" is displayed.
There are many causes for this error, and path errors are also one of them. My problem here is that the types on my page are different from those of my defined properties, my attribute is of the int type, but a comma is added to the output on the page, and the thousands are separated. This problem occurs.

This problem occurs only in strtus2.1 and later versions. The above solution has already mentioned the cause. In actual application, I guess in most cases, Int or other types of variables should be defined in the action, and then I expect the Struts to automatically fill in the Form to convert the post data. In this case, the conversion may fail, this error is caused. Therefore, you can use FF's httpfox to check the actual post parameter and then compare it with the corresponding attribute in the action, the conversion error occurs.

The other method is adding a breakpoint to all the sets mentioned above, and you can always see which method fails to be executed.

In addition, the page submits multiple parameters with the same name, for example

Username 123
Username 123
Permissions 123
Info 31234

In fact, the best thing is that the corresponding attributes of action and post are set to the string type, which saves trouble and will no longer cause this error, and then execute the conversion in execute. This facilitates errors.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.