配置新增、更改时增加不可见字符过滤(\t\r\n)

This commit is contained in:
chenjinsong
2018-08-08 14:53:37 +08:00
parent 04967492c3
commit 1ce9ec8d1a

View File

@@ -280,6 +280,9 @@ public class BaseController {
binder.registerCustomEditor(String.class, new PropertyEditorSupport() { binder.registerCustomEditor(String.class, new PropertyEditorSupport() {
@Override @Override
public void setAsText(String text) { public void setAsText(String text) {
Pattern p = Pattern.compile("\t|\r|\n");
Matcher m = p.matcher(text);
text = m.replaceAll("");
setValue(text == null ? null : StringEscapeUtils.escapeHtml4(text.trim())); setValue(text == null ? null : StringEscapeUtils.escapeHtml4(text.trim()));
} }
@Override @Override