spring.tld tag library attributes differences

225 Views Asked by At

In many tags of spring.tld there are those attributes: htmlEscape javaScriptEscape

The question may seem trivial, but which is the difference from html escape and javascript escape in this context?

1

There are 1 best solutions below

0
Ashish On BEST ANSWER

Well the htmlEscape is use to escape literal within the html document. like for example, if the html document contains special characters, it will be escaped as follows:

Original : <    >    "      &
Escaped  : &lt; &gt; &quot; &amp;

Javascript escape will apply across javascript literal. Suppose I have the literal:

<script>
    function helloWorld(){
        alert('<html:message javaScriptEscape="true" code="hello" />')
    }
<script>

Applying a javascript will escape the single and double quotes, the newline chars, the tabs, etc.