Matthias Wessendorf wrote:
well,
with facelets or jsf 1.2 that can be done ;)
True, but why? Rendered seems to fit his needs perfectly. :)
On 1/17/07, Joost Schouten <[EMAIL PROTECTED]> wrote:
Thanks Simon!
That did the trick. And no more <c:xxx/> tags for me ;-)
Cheers,
Joost
-----Original Message-----
From: Simon Kitching [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 17, 2007 4:14 PM
To: MyFaces Discussion
Subject: Re: JSTL and JSF
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