Actually, you can use functions in jsf el. It's just difficult to
install functions under the MyFaces EL implementation.
Using facelets or JSF RI makes it far easier (and supports
jstl:length, which is what you want, just by setting up a namespace
reference).
For example, using MyFaces and Facelets, I can do this:
======================
xmlns:jstl="http://java.sun.com/jsp/jstl/functions"
<h:commandButton rendered="#{1 !=
jstl:length(equipmentCategory.activityTypeList)}" ...
======================
If you need to do this in "pure" MyFaces, then see this thread. This
shows how I used to do this before I switched over to using Facelets
as my ViewHandler.
http://www.archivum.info/[email protected]/2005-07/msg00390.html
-Mike
On 11/5/05, Mathias Brökelmann <[EMAIL PROTECTED]> wrote:
> unfortunately you can not use functions in jsf el expressions.
> try to create a new method in your handler which determines if the
> list contains only one element.
>
> 2005/11/5, Kevin Hale Boyes <[EMAIL PROTECTED]>:
> > I have a handler return a list of SelectItems that I use as:
> >
> > <h:selectOneMenu ...>
> > <f:selectItems value="#{handler.types}"/>
> > ...
> >
> >
> > But, if there is only one item in the list then I'd like to change it
> > to plain output text (and a hidden input)
> >
> > So, I tried
> >
> > <h:panelGroup rendered="#{length(handler.types) > 1}">
> > <h:selectOneMenu ...>
> > </h:panelGroup>
> > <h:panelGroup rendered="#{length(handler.types) == 1}">
> > <h:inputHidden rendered="true" ...
> > </h:panelGroup>
> >
> >
> > but that isn't valid expression syntax.
> >
> > How do I get the size of my collection (List)?
> >
> > Thanks,
> > Kevin.
> >
>
>
> --
> Mathias
>