Hi Dennis, Laurie thanks for the prompt reply.

I found following code on jsffaq.com, I will try it work for me.

FacesContext fc = FacesContext.getCurrentInstance();
String userName =
(String)fc.getApplication().createValueBinding("#{Person.userName}").getValue(fc);


 <managed-bean>
        <managed-bean-name>Person</managed-bean-name>
        <managed-bean-class>demo.PersonBean</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
        <managed-property>
                <property-name>userName</property-name>
                <property-class>java.lang.String</property-class>
                <value/>
        </managed-property>
 <managed-bean>


Thanks again, Yogesh

On 2/4/06, Laurie Harper <[EMAIL PROTECTED]> wrote:
> Yogesh Chaudhari wrote:
> > Hi,
> >
> > I would like to read "show" managed property value in InvoiceBean
> > class constructor so I can populate different resultset in "invoices"
> > arraylist to display on page.
> >
> > Thanks, Yogesh
> >
> > public class InvoiceBean {
> >       private String show;
> >        ArrayList invoices;
> >
> >       public InvoiceBean () {
> >               System.out.println("show invoices " + show);
> >               invoices = getInvoices();
> >       }
> >
> > <faces-config>
> >   <managed-bean>
> >     <managed-bean-name>invoiceALLBean</managed-bean-name>
> >     
> > <managed-bean-class>org.adr.faces.backing.InvoiceBean</managed-bean-class>
> >     <managed-bean-scope>request</managed-bean-scope>
> >     <managed-property>
> >       <property-name>show</property-name>
> >       <property-class>java.lang.String</property-class>
> >       <value>ALL</value>
> >     </managed-property>
> >   </managed-bean>
> >
> >   <managed-bean>
> >     <managed-bean-name>invoicePENDINGBean</managed-bean-name>
> >     
> > <managed-bean-class>org.adr.faces.backing.InvoiceBean</managed-bean-class>
> >     <managed-bean-scope>request</managed-bean-scope>
> >     <managed-property>
> >       <property-name>show</property-name>
> >       <property-class>java.lang.String</property-class>
> >       <value>PENDING</value>
> >     </managed-property>
> >   </managed-bean>
> > ..
> > ..
> > ..
> > </faces-config>
> >
>
> The short answer is you can't. Properties are set on a bean after it's
> constructed (since before it's constructed there's nothing to set a
> property on...).
>
> You have a couple of options:
>
> - call getInvoices() from setShow()
>
> - call getInvoices() lazily when needed, after the show property has
> been set.
>
> I'd recommend the latter but either would work.
>
> L.
>
>

Reply via email to