开发者

url attribute of <h:graphicImage/> not accepting 2nd request parameter

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&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?


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)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜