Using & in the URL causes an XML error. The reference to the object "foo" must end with the character ';' limiter

I am trying to get a Google map image with the following code:

<img src="http://maps.googleapis.com/maps/api/staticmap?center=#{profile.latitude},#{profile.longitude}&zoom=14&size=400x400&sensor=false"/> 

but I get an exception in my browser that says:

Error analysis /content/profile.xhtml:
Trace error [line: 48] The reference to the zoom object must end with the symbol ';' delimiter.

How to avoid interpreting & in URLs as XML?

+4
source share
1 answer

Replace & with &amp; when markup is parsed as XML and &zoom treated as an HTML object that does not exist in XML.

+9
source

Source: https://habr.com/ru/post/1388896/


All Articles