myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Robinson <>
Subject Re: [TRINIDAD] Please help with dependent components
Date Mon, 15 Feb 2010 23:24:51 GMT
Option 1)
Instead of using entryBean.subProjects to check for disabled, why not,
since you are already using component binding, just set the component
disabled attribute to true or false based on when it changes. Set it
to true in the page and then when you set it in the component, it will
remember that state and no longer check the EL.

Option 2)
Store the disable state in the pageFlowScope

Option 3)
Use a session scoped bean to store the disabled state

Option 4 (JSF 2 only))
Store the disabled state in the viewScope

Option 5 (3rd party))
Store the value in a conversation scope provided by a 3rd party library

On Mon, Feb 15, 2010 at 1:02 PM, Jean-Noël Colin <> wrote:
> Andrew,
> entryBean is indeed in request scope.  Indeed, entryBean.subProjects is always null,
and I suspected this was related to the 'disabled' attribute. Thus my question is: how can
I set the proper value before the decoding is done? When should that be performed?
> Thanks for your help
> Jean-Noel
> On 15 Feb 2010, at 19:03, Andrew Robinson wrote:
>> What scope is entryBean?
>> If entryBean is requestScope, then entryBean.subProjects will be null
>> on each request and would need to be set before the decoding is done,
>> otherwise the 2nd choice will never decode as it will be disabled. If
>> entryBean is not requestScope than you also have a problem as you
>> cannot use component binding with non-request scoped objects.
>> -Andrew
>> On Sun, Feb 14, 2010 at 8:32 AM, Jean-Noël Colin <> wrote:
>>> Hi
>>> I need to write a simple page with 2 selectOneChoice components, the second being
dependent on the first. This means that the second should be disabled as long as a correct
value in the first one has not been selected. Also, the items in the second need to be dynamically
loaded depending on the content on the first one.
>>> I guess this should be easily feasible in Trinidad, but obviously, I must be
missing something because I can't get it to work. it seems that the value of the second component
never gets properly populated in the bean entry. Also, strangely, in the 'valuechangelistener',
the oldvalue is always null, even when a proper value was correctly selected.
>>> Also, is it possible to avoid the presence of a 'empty' selectItem by auto-selecting
the first valid entry (how can I do that)?
>>> Thanks a lot for your help
>>> Jean-Noel Colin
>>>                                <tr:selectOneChoice id="project"
>>>                                        binding="#{entryBean.projectSelector}"
>>>                                        value="#{entryBean.currentLine.projectId}"
>>>                                        autoSubmit="true"
unselectedLabel="Select" immediate="true"
>>>                                        valueChangeListener="#{entryBean.projectChangeListener}">
>>>                                        <f:selectItems
value="#{globalData.activeprojects}" />
>>>                                </tr:selectOneChoice>
>>>                                <tr:selectOneChoice id="subproject"
>>>                                        partialTriggers="project"
>>>                                        value="#{entryBean.currentLine.subProjectId}"
>>>                                        unselectedLabel="Select"
disabled="#{empty entryBean.subProjects}">
>>>                                        <f:selectItems
value="#{entryBean.subProjects}" />
>>>                                </tr:selectOneChoice>

View raw message