tags:

views:

52

answers:

1

I use a Servlet to stream an image from the database and I use the tag for display as follows:

<h:graphicImage url=”/servletUrl?para1=name1&para2=name2”/>

The problem starts if I include the 2nd parameter (&para2=name2) and I get the following error message:

The reference to entity "para2" must end with the ';' delimiter

Am I missing anything?

+2  A: 

The ampersand & is actually an special character in XML. The ampersand is to be used to indicate the start of a XML entity like &gt;, &lt; 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 &amp;.

<h:graphicImage url="/servletUrl?para1=name1&amp;para2=name2" />

(note that I fixed the invalid curly quotes as well)

BalusC
Great! Your answer solved this problem. Thank you.
MISS_DUKE
You're welcome. Don't forget to mark the answer accepted. See also http://stackoverflow.com/faq.
BalusC
I can't find any links to mark this answer as accepted which I really like to do. This may be due to I am new and having only 1 reputation point. Thanks again.
MISS_DUKE
[Note how your mouse behaves above the empty checkmark on the left hand side](http://meta.stackoverflow.com/questions/16721/what-is-an-accept-rate-and-how-does-it-work/65088#65088).
BalusC
Oh, yeah. Done. Thanks.
MISS_DUKE
You're welcome.
BalusC