In the file aPage.xhtml
, I have the following lines:
<ui:include rendered="#{not empty param.target}" src="#{param.target}.html" />
<ui:include rendered="#{empty param.target}" src="About.html" />
With the above lines, I expected that when I go to http://localhost:8080/beta/aPage.xhtml
, the page About.html
would be included since the param.target
is null
. However, GlassFish threw me the following exception:
java.io.FileNotFoundException: http://localhost:8080/beta/.html
Somehow, param.target
was not considered to be null
.
Besides, I did try to use ==
and !=
operators as following:
<ui:include rendered="#{param.target != null}" src="#{param.target}.html" />
<ui:include rendered="#{param.target == null}" src="About.html" />
Interestingly, this time, on the console of GlassFish, I didn't see any exception thrown. However, on the browser, an error page still appears with the exception java.io.FileNotFoundException
.
I'd be very grateful if you could tell me why this happened and what I should do to avoid it.
UPDATE:
Thanks to the hint from Joop Eggen, I finally solved the problem with the following lines:
<ui:param name="noTarget" value="About.html" />
<ui:param name="hasTarget" value="#{param.target}.html" />
<ui:include src="#{empty param.target? noTarget : hasTarget}" />
Best regards