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.