Joost Schouten wrote:
Hi,
I have the below code trying to print a dataTable when the backing bean
found entries, or "no results" when none are found. But my JSTL tags don't
seem to have access to my JSF backing beans. What is the best way to combine
JSTL and JSF, or are the other JSF tags/attributes I should use for this
purpose?
My table gets printed nicely without the JSTL c:if and c:choose tags
Thank you,
joost
<h:form id="searchResults" onsubmit="return validateForm(this);">
<c:if test="#{jsp$searchResults.query!=null">
<c:choose>
<c:when test="${jsp$searchResults.hits > 0" >
<!-- only show the dataTable if there is a query -->
<t:dataTable
Combining JSTL conditional tags (or loops) with JSF+JSP1.1 is a very bad
idea; it can result in very weird behaviour.
Instead, do:
<t:dataTable rendered="#{searchResults.hits > 0}" ....>
</t:dataTable>
<t:outputText rendered="#{searchResults.hits == 0}"
value="No results"/>
Regards,
Simon