dev@javaserverfaces.java.net

Re: SelectItemsIterator failing when getting value for #{Form.map.key.list}-type EL expressions

From: Ryan Lubke <Ryan.Lubke_at_Sun.COM>
Date: Fri, 18 Jan 2008 11:33:55 -0800

wazoo999 wrote:
> Hi, I'm experiencing very weird issues using the selectItems tag.
>
> The backing bean (OrdersForm) has an instance method getUpdateOptionsMenu()
> that returns the List of SelectItem's. The page is rendered and validated
> well when using the "#{OrdersForm.updateOptionsMenu}" expression in
> f:selectItems value attribute.
>
> That very bean has a method getGet that returns a Map of NamedItem's.
> NamedItem is a simple abstract class that can return a List, Object or Map
> depending on use.
> Pages can retrieve the appropriate NamedItem by supplying the appropriate
> String key. I use this approach to reduce the number of getters in the
> backing beans.
> Example: #{OrdersForm.get['customers'].list} or #{OrdersForm.get.user.item}
>
>
> Enter the weird issues. When the page is being rendered, the
> UISelectItems.getValue() that is called by the
> RenderkitUtils.getSelectItems() appears to process the
> "#{OrdersForm.get.updateMenu.list}" expression correctly. But when the form
> is being submitted and we enter the the ProcessValidationsPhase where the
> SelectItemsIterator is used to retrieve the values then
> ValueExpression.getValue() returns 'null' for that very expression.
>
>
> The weirdest thing is that the expression is evaluated well in one phase and
> resolves to null in another. Any thoughts on how to fix this? I've traced it
> that far, but don't have enough time and knowledge to research it further
> on.
>
> Alex.
>
To start, what version of Mojarra are you using?