use
- ServletActionContext.getResponse().getWriter()
When the front desk to write information, often unterminated string literal error: unterminated string constants, most likely due to the presence of the string line breaks caused. Presence \ r \ n
Solution:
Before the result is written to the foreground, the special symbol rows string escaped out of exchange,
- PrintWriter pw = ServletActionContext.getResponse().getWriter();
- result = result.replace("\n\r", "<br> ");
- result = result.replace("\r\n", "<br> ");
- result = result.replace("\t", " ");
- result = result.replace(" ", " ");
- result = result.replace("\"", "\\" + "\"");
- pw.print(result);
Reproduced in: https: //my.oschina.net/xiaominmin/blog/550879