I have a JSF 2 .xhtml page with javascript in the page code.
In that javascript code, I have the folowing:
var lat1 = latlng1.lat();
var lat2 = latlng2.lat();
var minLat = lat1<lat2?lat1:lat2;
var maxLat = lat1<lat2?lat2:lat1;
I get a page error that complains about the < sign – apparently the parser thinks it is an xml type symbol, rather than a “less than” sign.
javax.servlet.ServletException: Error Parsing /index_2.xhtml: Error Traced[line: 87] Element type “lat2” must be followed by either attribute specifications, “>” or “/>”.
How can I get around this?
I suspect I can probably move it into a javascript library, but I am just trying to do a simple test to see if I can do what I am trying to accomplish.
Thanks.
Put it in a CDATA-section:
…otherwise a XML-parser will interpret the < as the start of an element.
CDATA will not be parsed.