duminică, 13 septembrie 2015

[OmniFaces utilities 2.0] Escapes the given string according the JavaScript code rules


[OmniFaces utilities] The escapeJS() function escapes the given string according the JavaScript code rules. This escapes among others the special characters, the whitespace, the quotes and the unicode characters. Useful whenever you want to use a Java string variable as a JavaScript string variable.

Function:
See also: Utils.escapeJS()
Usage:

For details about JavaScript character escape sequences please read: JavaScript character escape sequences. In order to understand how powerful/complete is the OmniFaces implementation, you really need to study the source code of of:escapeJS() function:

#{of:escapeJS("Fingerspitzengefühl is a German term.")}
Output: Fingerspitzengef\u00fchl is a German term.

Niciun comentariu:

Trimiteți un comentariu