The last time we stumbled upon a problem, we were in a huge project, followed by spring web flow, last submitted, submitted successfully, but when we returned to a page, there was always an error, saying a variable such as Var projectInfo, which was null.
Then we took a closer look at the code, originally because there is a field on this page is textarea, and then it will support multiline input, multiple lines is \ n, and then in ExtJS's view, it cannot be decode for a string containing \ n, so the result of Decode is null
Our experiment is as follows:
(1) Ext.decode a string containing \ n:
Here you can see that decode will fail.
(2) Ext.decode A string that does not contain \ n or contains all of the \ n transitions to \\n:
See here decode will succeed.
Based on this idea we will find the right solution, we just need all ' \ n ' to replace ' \\n ' on it, for this in the JS code:
The original is:
var projectInfo = Ext.decode (decodeURIComponent (' ${projectinfojsondata} ', true);
Now change to:
var projectInfo = Ext.decode (decodeURIComponent (' ${projectinfojsondata} '). Replace (/\n/g, ' \\n '), true);
This article from the "Cohesion of parallel Lines" blog, please be sure to retain this source http://supercharles888.blog.51cto.com/609344/1222093
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/webkf/Extjs/