Analysis and solution of failure of struts 2 date conversion on win10

New win10 operating system with ie11 and edge.

A project developed uses struts 2, which has no problem running development before. Today, I suddenly found that a modification function is not easy to use. Through investigation, it is found that there is a date format text box on the page, and there is a value in it. An error prompt will appear when submitting:

No result defined for action xxx. TestAction and result input

At this time, it can be judged that there is a problem with date conversion. But I'm not sure whether it's the browser or the operating system. So I changed several browsers and tested with virtual machines and other computers. It was found that only ie11 and edge on my host had this problem. Other people's ie11, ie10 in my own virtual machine and Google browser on the host didn't have this problem. In this way, I still can't accurately judge the cause of the error, but I prefer that the configuration of my host causes problems in my program.

First, I thought it was struts 2 X, and then put struts 2 X upgrade to the latest version, and also read the struts 2 upgrade report (this problem is not mentioned), the problem remains.

Then I searched the Internet and thought I needed to implement a date converter to correct this "bug". Halfway through the converter, it suddenly occurred to me that I should debug and track to confirm whether it is the default date converter of struts.

During tracing and debugging, it is found that locale is en_ Us, it's strange. The country or region of my operating system is China. It seems that I don't understand myself.

Since it is the locale problem, it seems that struts 2 can set the default locale through configuration. So in struts Add a line of configuration in the XML file:

Then test again, and finally passed. The process is very simple. In fact, I tossed for nearly 2 hours. So we can't easily replace the development environment.

Write it down, hoping to help others.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>