The code for all of this can be found below:
Code: Select all
<ui:define name="helpDiv">
<p:lightBox iframe="true" id="helpbox" width="1000px" visible="#{user.getCount() == 0}">
<h:link outcome="path/pagename">
<h:graphicImage library="images" name="image.png" />
</h:link>
</p:lightBox>
</ui:define>
However, if the user loads the page in any way such that the url is correct (such as directly typing in the url), clicking on the image opens the page in the LightBox like expected.
I've compared the generated html code and found one minor difference between the two scenarios. Here are the two scenarios:
1. Page navigated to using commandButton, such that the url reads: http://www.example.com/webapp
Generated HTML:
Code: Select all
<div id="helpbox">
<a href="/webapp/path/pagename.xhtml">
<img src="/webapp/javax.faces.resource/image.png.xhtml?ln=images" alt="">
</a>
</div>
When the user clicks on the image, the user is redirected to the pagename.xhtml page. ***This is the incorrect behavior***
2. Page navigated to such that the url reads: http://www.example.com/webapp/thispage.xhtml
Generated HTML:
Code: Select all
<div id="helpbox">
<a href="/webapp/path/pagename.xhtml">
<img src="/webapp/javax.faces.resource/image.png.xhtml?ln=images">
</a>
</div>
When the user clicks on the image, the user is shown the pagename.xhtml page in a LightBox ***This is the expected behavior***
So the only difference I can see between the two is the img tag has an empty alt parameter. Is that the root of the problem? If so, why would an empty alt tag create a bug like this, and why is the alt tag only showing up when the url is incorrect? Also, how would I fix this?