The struts2 action method cannot be entered.

Source: Internet
Author: User

Recently, I used struts2 to implement a function. The content in the input tag corresponds to the object class content in the background. When I submit a method, I cannot enter the action method and the program does not report an error, no methods were found after checking for n times. Finally, the query found that the input tag passed a string type string, but the background object class was defined as int, leading to the absence of action requests. The reason for careful analysis is that struts2 has encapsulated the package and encountered errors, but it has caught it. Therefore, no error is thrown, so you cannot start. Be careful with the record.

Upload a photo to the background. <input type = "file" style = "width: 150px;" id = "uploadfile" name = "uploadfile"> the tag type is file, private file uploadfile is also received in the background; // upload a photo. However, if you find that the request method does not go away, the program will not throw an error, in the end, we found that we did not write the Declaration enctype = "multipart/form-Data", and wrote it in form. By default, this encoding format is application/X-WWW-form-urlencoded and cannot be used for file upload. Only multipart/form-data can be used to completely transmit file data.

The struts2 action method cannot be entered.

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.