I have an object field with person\'s last name.
If I use ${person.lastName}, I get O\'Brian
If I use
You could define a new EL function that escapes strings for you.
E.g.
In Java
public class MyStringUtil {
public static String escapeJs( String str )
{
// escape the string (e.g. replace ' with \')
}
}
In a tag library descriptor file:
escapeJs
package.to.MyStringUtil
java.lang.String escapeJs( java.lang.String )
Then in your JSP (assuming you've included your .tld
with a prefix of foo
: