SpringMVC 表单标签中 htmlEscape 属性的作用

一、SpringMVC 表单元素标签 如下:

<form:textarea path="remarks" htmlEscape="false" class="input-xlarge"/>
其中的属性 htmlEscape的作用是? 大致的意思是起转义作用。

二、测试如下

1、htmlEscape="false" , 输入内容 "<" ;结果如下图


2、htmlEscape="true" , 输入内容 "<" ;结果如下图


3、去掉 htmlEscape 属性 , 输入内容 "<" ;结果如下图



三、 总结

1、htmlEscape 属性作用理解为:是否转义字符, 默认为 true ,若要设置不对特殊字符进行转移,需设置为 false 。
2、转义字符为: < > " & ( 转义字符是 XML中5个预定义的实体引用)


猜你喜欢

转载自blog.csdn.net/laputa_sky/article/details/80038100