Hi Marcus,
 
Many thanks Marcus for your kindly reply.
 
I think your point is reasonable. My ColleagueRole class doesn't have the 
equals method overwriten. I will add it and let you know.

Thanks again.
 
Regards,
Peter

At 2011-09-18 16:50:03,"Marcus Kröger" <marcus.kroe...@googlemail.com> wrote:
>Hi Peter,
>
>to me it sounds like your clgBasicMaintain.clg.role either returns null 
>or the value is not in your role list. Did you overwrite the equals 
>method of your ColleagueRole class to make sure that the value you 
>return by calling clgBasicMaintain.clg.role returns the same object that 
>is in the role list?
>
>If the object is not found in the role list the first object found in 
>the list will always be the selected one.
>
>regards
>Marcus
>
>Am 18.09.2011 02:03, schrieb zjzhoufy:
>> Could anyone help on this please?
>>
>> At 2011-09-17 18:39:13,zjzhoufy<zjzho...@163.com>  wrote:
>>> Hi,
>>>
>>> How could I set up the default value of a drop down list 
>>> (tx:selectOneChoice) to the initialized value in the object?
>>>
>>> Here is the code in my jsp file content:
>>>      <tx:selectOneChoice id="mtn_basic_role_select" label="Please select a 
>>> role"
>>>       value="#{clgBasicMaintain.clg.role}" converter="clgRoleConverter">
>>>               <f:selectItems value="#{listservice.roleList}"  
>>> id="roleList_item" />
>>>      </tx:selectOneChoice>
>>> ------------------------------------------
>>> clgBasicMaintain.clg.role with type ColleagueRole, and 
>>> #{listservice.roleList} is a SelectItem list with value type ColleagueRole 
>>> and label is the role name.
>>>
>>> clgRoleConverter could convert the role name to the ColleagueRole object.
>>>
>>> Now the object clgBasicMaintain.clg already has an initialized value. But 
>>> every time I run this page, the defaule value of the drop down list is set 
>>> to the first SelectItem of the list.
>>>
>>> How could I set up the default value of the drop down list to the 
>>> initialized value please?
>>>
>>> If you need any more information, please let me know.
>>>
>>> Many thanks.
>>> Regards,
>>> Peter Zhou
>>>
>>> --

Reply via email to