Thoughts on one project deployment and project deployment
Server deployment project summary
I. Problems
If a project running normally on the local machine is deployed on the remote server, some functions run incorrectly. The error message is "No Result Defined For Action And Result Input". Because the project is running normally on the local machine, therefore, it is initially believed that the Operation errors are caused by the java environment on the remote server. However, after the JDK, Tomcat, and other environments on the server are reinstalled and the local environment is consistent, the same errors are still reported, none of the Methods searched on the Internet solved the problem. Later, the problem was found using the debug tag of struts2, the problem is that the temporary path of the uploaded file cannot be found. As a result, the form submission with the file upload cannot be verified by the struts2 interceptor and "INPUT" is returned. However, there is no configuration for "INPUT" in the action, therefore, the above error occurs.
In an error form, the file upload function is implemented using the fileUpload method of struts2. to upload a file, you must obtain the absolute and relative paths of the uploaded file, however, these two are only required for file upload and persistence. In addition to these two paths, a virtual path is also required. This virtual path is used to save the temporary files generated by the uploaded files, that is, a temporary path. If the file upload fails, the temporary file is also stored in this path. If not configured, the default javax. servlet. context. tempdir to save the file, but set <constant name = "struts. multipart. saveDir "value =" c:/test "/> then the temporary path of the file to be uploaded is changed to the test folder of drive c, but the Save path of the temporary file previously set is on the edisk, however, the remote server only has a drive C and no drive E. As a result, the specified path cannot be found and an error is returned. The solution is to change the temporary file to the system disk on the remote server.
Ii. Reflection
1. the first thing I have to say is that I am not familiar with the use of the fileUpLoad component of struts2. Every time I use it, I Copy and modify the examples I have written or found online, the code can also understand what it means and implement the required functions. Although this can improve the efficiency, some configuration or details are easy to forget, and you do not know where the problem is when something goes wrong, a small error may be difficult to understand for a long time, but it is very easy to find the problem where the error is located. Therefore, you will try to understand whatever it is in future development and learning, looking at the details, it may take a lot of time at the beginning, but you can quickly write the code in future use and locate problems quickly, I still need a lot of effort in this regard.
2. I once saw such an article in the blog Park, saying that A restaurant owner asked employees in the store to investigate the prices of chicken in the market. Employee A directly ran several markets, after investigating the chicken price, employee B asked the boss in detail why he wanted to investigate the chicken price. Then he not only went to the market to investigate the chicken price, but also went to another hotel to investigate the chicken price, employee C not only investigates the chicken price, but also the prices of similar products such as duck and fish. Employee D, while investigating the chicken price, also thinks whether a good cook is needed, just one of our friends was the cook. Then we introduced it to the boss and reserved talent for the hotel. Then the four employees mentioned above scored 60/70/80/90 points, because employee A only completed the task, while finishing the task, employee B also knows why the task should be completed. Although I do not remember the reason why employee C and employee D scored 80/90 points, I am always ahead of consciousness, this is because when you finish the task, you not only know why you want to complete the task, but also think of related things. For me, what I lack is a kind of advanced consciousness. Sometimes a function is completed, only a function is completed, or sometimes I know why this function is completed, however, the encapsulation, reuse, and extension of some of these functions are not enough. The above example may not be appropriate, in fact, I mainly want to talk about code refactoring. In the future, I may want to do more in this regard. How do I feel the above example is nonsense?
3. the third aspect may be a bit similar to the first one, that is, every time I study some things, I usually try to understand them, such as fancybox and ajaxForm, But it is not all because I do not want to study them in depth, my JQUERY capabilities are still too weak, and many JS Code cannot understand it at all. This is something that can be supplemented later than half past one, so I will find time to continue learning, in addition, some research results are written and recorded.
This is what we can think of now. We will record other problems later.