You have to add  methods to beanA to store/retrieve the selected item property 
from 
there. The faces-config.xml doesn't maintain state for managed-property.

--
Rob

@objectsource.org


---------- Original Message -----------
From: "Mihir Solanki" <[EMAIL PROTECTED]>
To: "'MyFaces Discussion'" <[email protected]>
Sent: Tue, 12 Apr 2005 18:14:59 +0530
Subject: Selecting the first item in the SelectOneList box

> Hi,
> 
> I have following in my application
> 
> Faces-config.xml
> 
>     <managed-bean>
> 
>         <managed-bean-name>BeanA</managed-bean-name>
> 
>         <managed-bean-class>com.BeanA</managed-bean-class>
> 
>         <managed-bean-scope>session</managed-bean-scope>
> 
>             <managed-property>
> 
>                   <property-name>beanID</property-name>
> 
>                   <value>[Select BeanID...]</value>
> 
>             </managed-property>
> 
>     </managed-bean>
> 
> Test.jsp
> 
>                       <h:form id="navForm">
> 
>                               <h:panelGrid id="grid1" columns="1" border="0"
> cellpadding="1" cellspacing="1" align="left">
> 
>                                     <h:selectOneListbox id="fileroom-list"
> value="#{BeanA.beanID}"  size="1"
> 
> onchange="document.forms['navForm'].submit();">
> 
>                                     <f:valueChangeListener type="com.BeanA"
> />
> 
>                                 <f:selectItems value="#{BeanA.listAll}" />
> 
>                               </h:panelGrid>
> 
>                         </h:form>
> 
> Now as shown above, my BeanA's listAll method is returning list of items and
> it is available to my select box also.
> 
> What I want to do is, when my page gets loaded I need to somehow set the
> first selected item either in SESSION-MAP
> 
> Or in the BeanA's beanID property. How can I do this?
> 
> Currently what happens is my page gets loaded and when I check the selected
> item's value its showing me "[Select BeanID...]"
> 
> Mihir
> 
>   _____
> 
> Patni Computer Systems Ltd.
> 
> Tel : 91 79 23240905 Ext : 413
> 
> http://www.patni.com
> World-Wide Partnerships. World-Class Solutions.
> _____________________________________________________________________
> 
> This e-mail message may contain proprietary, confidential or legally
> privileged information for the sole use of the person or entity to
> whom this message was originally addressed. Any review, e-transmission
> dissemination or other use of or taking of any action in reliance upon
> this information by persons or entities other than the intended
> recipient is prohibited. If you have received this e-mail in error
> kindly delete  this e-mail from your records. If it appears that this
> mail has been forwarded to you without proper authority, please notify
> us immediately at [EMAIL PROTECTED] and delete this mail. 
> _____________________________________________________________________
------- End of Original Message -------

Reply via email to