tags:

views:

111

answers:

2

Hello, I have a simple problem on .xhtml page. This expression is not working :-

<a href="Photos.jsf?albumId=#{item.albumId}&blogId=#{PhotoAlbumsCommonBean.blogId}">
 photos
</a>

I get this error :-

Error Parsing /Common/PhotoAlbums.xhtml: Error Traced[line: 20] The reference to entity "blogId" must end with the ';' delimiter.

& is causing some kind of error. Thanks in advance :)

+4  A: 

Try to encode the ampersand - & with &amp;

Petar Minchev
It doesn't work :(. Now the error is :-The reference to entity "ampblogId" must end with the ';' delimiter.
Ankit Rathod
Petar Minchev
Skip Head
yes now it works. Thanks :). Completely missed ;
Ankit Rathod
@Petar - you can use the backtick character to escape code in the Markdown editor
McDowell
@McDowell Good to know, thanks:)
Petar Minchev
+1  A: 

The error is caused by the # signs.

Try this. It fixes the problem with the JSP EL and having ampersands encoded in XHTML pages:

<a href="Photos.jsf?albumId=${item.albumId}&amp;blogId=${PhotoAlbumsCommonBean.blogId}">
 photos
</a>
Steven Paligo
Steven Paligo
Hi Steven, your answer is also correct. Don't know which one to vote as correct and give points :p. But i think, $ is not meant for JSF. It is for JSP, though it works.
Ankit Rathod
I guess the correct symbol to use depends if you want immediate or delayed variable expansion. Good point.
Steven Paligo