I use a Servlet to stream an image from the database and I use the tag for display a开发者_如何转开发s follows:
<h:graphicImage url=”/servletUrl?para1=name1¶2=name2”/>
The problem starts if I include the 2nd parameter (¶2=name2) and I get the following error message:
The reference to entity "para2" must end with the ';' delimiter
Am I missing anything?
The ampersand &
is actually an special character in XML. The ampersand is to be used to indicate the start of a XML entity like >
, <
and so on. Hence the exception message that it is expecting a ;
which indicates the end of a XML entity.
To represent a standalone ampersand, you need to represent it as &
.
<h:graphicImage url="/servletUrl?para1=name1&para2=name2" />
(note that I fixed the invalid curly quotes as well)
精彩评论