Hi Mike,
For conditionally rendering components you can do anything you can w/
vanilla JSF (i.e. rendered="false"... although you may need to do
$boolean{false} to properly convert it).
You can also use the <if> component to use a boolean expression to
determine if its children should be rendered. However, if poorly
written components do not render all their children, or expect only
children of a particular type... they may not properly work with the
<if> component. (BTW, the if can be used as a regular component or via
special syntax: <!if [boolean expression]> [conditionally rendered
children] </if>).
Looking at the Breadcrumbs source code (the source I have is old... so
perhaps its been fixed), it appears that:
1) They only allow Hyperlink components (bad)
2) They do not respect "rendered=false" components (bad)
The code iterates over all children, casts each one unnecessarily to a
Hyperlink (it does use the "text" property, but could just as easily use
the "real" "value" property and do so via the attribute map). It then
unconditionally renders each one (which may be hidden, so it won't show
up) and immediately places the separator (also unconditionally).
So what you are attempting to do will not work because of the way the
component was written. You should file a bug against the component and
hope that it has already been fixed or that it will soon.
Good luck!
Ken
Mike Wright wrote:
> I'm trying to get the displayed breadcrumbs to accurately show the
> path I followed to get to a (shared) page, but in order to support the
> maximum number of links in the breadcrumbs, I see a problem when the
> path requires fewer links. e.g.
>
> > good: Application Server > Integration Applications > JBI
> Components > Libraries > placeholder SL > jbi.xml
> > bad: Application Server > Integration Applications > JBI
> Deployments > > placeholder SA > jbi.xml
> > s/b: Application Server > Integration Applications > JBI
> Deployments > placeholder SA > jbi.xml
>
> I include a .jsf page from four other .jsf pages, with breadcrumbs in
> the included file. The "including" .jsf files set the text/link
> values for the variable breadcrumbs. I've tried also setting a boolean
> in the "including" .jsf files to use with a rendered attribute on the
> not-always-needed breadcrumb hyperlink and I've tried setting the
> text/link values to empty string when they are not needed, but I end
> up with an extra ">" separator. (I've tried various things for the
> argument of the rendered attribute; it appears that these don't
> evaluate to false?)
>
> What's the recommended jsftemplating "best practice" for expressing a
> variable number of conditionally rendered subelements?
>
> Is there a documented expression language that I can use and any example?
>
> Regards,
> Mike