How to show JSF 1.2 selectonemenu with selected values from a list
<p>I am using jsf 1.2 selectonemenu, i have a requirement that when the page loads with the selectonemenu will load some data from database and a value will be selected in the listbox.i have done it using hardcode values.But When it is coming from DB it is not working, i am posting both my hardcode and db coding.</p>

<pre><code> &lt;h:selectOneMenu id="submenu" value="three"&gt;
    &lt;f:selectItem id="si1" itemLabel="One" itemValue="one" /&gt;
    &lt;f:selectItem id="si2" itemLabel="Two" itemValue="two" /&gt;
    &lt;f:selectItem id="si3" itemLabel="Three" itemValue="three" /&gt;
    &lt;f:selectItem id="si4" itemLabel="Four" itemValue="four" /&gt;

    &lt;/h:selectOneMenu&gt;
</code></pre>

<p>DB Coding </p>

<pre><code>  &lt;h:selectOneMenu id="submenu"&gt;
    &lt;f:selectItem id="si1"  itemValue="${useBean.memberDependentList}" /&gt;   
    &lt;/h:selectOneMenu&gt;
</code></pre>

<p>My Bean class </p>

<pre><code>List&lt;DependentDTO&gt; dependentList = new MemberProxy()
            .getDependentListFormMember( loggedInUser
                    .getUserAccessList().get(0).getClientCode(),
                    loggedInUser
                    .getUserAccessList().get(0).getCertificateNumber());
            List&lt;SelectItem&gt; selList=new ArrayList&lt;SelectItem&gt;();

            for(DependentDTO depDTO:dependentList){

                SelectItem sel = new SelectItem();
                sel.setLabel(depDTO.getNameFirst());
                sel.setValue(depDTO.getCertNumber()+"#"+depDTO.getClientCode()+"#"+depDTO.getDependentCode());
                selList.add(sel);   
            }
             mem = new MemberProxy().getMemberDetails(loggedInUser
                        .getUserAccessList().get(0).getClientCode(), loggedInUser
                        .getUserAccessList().get(0).getCertificateNumber());

             SelectItem sel = new SelectItem();
             sel.setLabel(mem.getNameFirst());
             sel.setValue(mem.getCertNumber().toString().trim()+"#"+mem.getClientCode().toString().trim()+"#"+depDTO.getDependentCode());
             selList.add(sel);

            memberDependent.setMemberDependentList(selList);
</code></pre>

<p>I am setting the person name in the label and  the value i am setting the certificate number ,client code and dependent code ,here the dependent code is unique.Certificate number and client code are same in both cases.Can i do something with the dependent code? when the list is populating in the dropdown. Because my purpose is to show always the mem.getNameFirst() selected when page is loaded.Is it possible  with any tricks???Please help i am new to JSF 1.2</p>

<p>How i will show  three as selected when loding data from database</p>