You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Peter Miller <pe...@yahoo.com> on 2005/10/01 22:12:11 UTC

Getting data before a pages first call

Where do I find the sources of the MyFaces examples?

 

I want to find out how pages such as the masterdetail manage to load data into their backing bean BEFORE the page is rendered.

I mean – it is easy to press a button which triggers a “get data” method and shows the results.

 

But how do I load data before a page is shown first? Through the constructor? Some "init" method?

 

I want to write a page that displays a list of items when it is called first. This page is the first page in the application so I can’t get any button of a previous page to call a “get data” method.

The data has to get into the backing bean beforehand. How?

 

The masterdetail example does the same thing. When it is called for the first time it displays a list of countries. But how do they get the data into the backing bean before the page is displayed?

 

Thanks

Peter


		
---------------------------------
Yahoo! for Good
 Click here to donate to the Hurricane Katrina relief effort. 

Re: Getting data before a pages first call

Posted by Mike Kienenberger <mk...@gmail.com>.
> But how do I load data before a page is shown first? Through the constructor? Some "init" method?

Using the constructor is one way.   If you don't have enough
information at constructor time (references to other beans), then you
can use the jsf-spring integration library which will allow you to
have your beans implement the InitializingBean interface, and that
will allow you to call a "afterPropertiesSet" method after everything
is initialized.

Another way to do this is execute some code when your list is rendered.

Ie, if your page has a <h:dataTable binding="page.dataTable">, then
you can initialize some things in "page.getDataTable()."  I personally
dislike this approach as it seems like something of a hack, but it's
the only way to do it with "pure" JSF unless you have backing bean
methods that look like this

public Object getX() { initialize(); return x; }


On 10/1/05, Peter Miller <pe...@yahoo.com> wrote:
>
>
> Where do I find the sources of the MyFaces examples?
>
>
>
> I want to find out how pages such as the masterdetail manage to load data
> into their backing bean BEFORE the page is rendered.
>
> I mean – it is easy to press a button which triggers a "get data" method and
> shows the results.
>
>
>
> But how do I load data before a page is shown first? Through the
> constructor? Some "init" method?
>
>
>
> I want to write a page that displays a list of items when it is called
> first. This page is the first page in the application so I can't get any
> button of a previous page to call a "get data" method.
>
> The data has to get into the backing bean beforehand. How?
>
>
>
> The masterdetail example does the same thing. When it is called for the
> first time it displays a list of countries. But how do they get the data
> into the backing bean before the page is displayed?
>
>
>
> Thanks
>
> Peter
>
>  ________________________________
> Yahoo! for Good
>  Click here to donate to the Hurricane Katrina relief effort.
>
>

Re: Getting data before a pages first call

Posted by Martin Marinschek <ma...@gmail.com>.
All sources are in the source distribution of Apache MyFaces - also
the examples sources.

regards,

Martin

On 10/3/05, Peter Miller <pe...@yahoo.com> wrote:
> Would someone please be so kind as to answer this question?
> I have read the archive of the mailing list and found a similar question
> before. But the answers did not help me much. They referred to the
> master/detail example but I still can't find the sources of the examples.
>
> Where are those sources?
>
> Thanks
>
> Peter
>
>
>
> Peter Miller <pe...@yahoo.com> wrote:
>
>
> Where do I find the sources of the MyFaces examples?
>
>
>
> I want to find out how pages such as the masterdetail manage to load data
> into their backing bean BEFORE the page is rendered.
>
> I mean – it is easy to press a button which triggers a "get data" method and
> shows the results.
>
>
>
> But how do I load data before a page is shown first? Through the
> constructor? Some "init" method?
>
>
>
> I want to write a page that displays a list of items when it is called
> first. This page is the first page in the application so I can't get any
> button of a previous page to call a "get data" method.
>
> The data has to get into the backing bean beforehand. How?
>
>
>
> The masterdetail example does the same thing. When it is called for the
> first time it displays a list of countries. But how do they get the data
> into the backing bean before the page is displayed?
>
>
>
> Thanks
>
> Peter
>
> ________________________________
> Yahoo! for Good
> Click here to donate to the Hurricane Katrina relief effort.
>
>
>
> ________________________________
> Yahoo! for Good
> Click here to donate to the Hurricane Katrina relief effort.
>
>


--

http://www.irian.at
Your JSF powerhouse -
JSF Trainings in English and German

Re: Getting data before a pages first call

Posted by hicham abassi <ha...@gmail.com>.
Peharps a PhaseListener with a
getApplication().createValueBinding("#{yourManagedBeanScope.yourManagedBean}").setValue(getFacesContext(),yourManagedBean);


2005/10/3, Andrew robinson <an...@gmail.com>:
> There is a really long topic on the Java forums on the "OnLoad" event that
> can be found here:
>  http://forum.java.sun.com/thread.jspa?threadID=541382
>
>
> On 10/3/05, Peter Miller < peadar_miller@yahoo.com> wrote:
> >
> > Would someone please be so kind as to answer this question?
> > I have read the archive of the mailing list and found a similar question
> before. But the answers did not help me much. They referred to the
> master/detail example but I still can't find the sources of the examples.
> >
> > Where are those sources?
> >
> > Thanks
> >
> > Peter
> >
> >
> >
> >
> > Peter Miller <pe...@yahoo.com> wrote:
> >
> >
> >
> > Where do I find the sources of the MyFaces examples?
> >
> >
> >
> > I want to find out how pages such as the masterdetail manage to load data
> into their backing bean BEFORE the page is rendered.
> >
> > I mean – it is easy to press a button which triggers a "get data" method
> and shows the results.
> >
> >
> >
> > But how do I load data before a page is shown first? Through the
> constructor? Some "init" method?
> >
> >
> >
> > I want to write a page that displays a list of items when it is called
> first. This page is the first page in the application so I can't get any
> button of a previous page to call a "get data" method.
> >
> > The data has to get into the backing bean beforehand. How?
> >
> >
> >
> > The masterdetail example does the same thing. When it is called for the
> first time it displays a list of countries. But how do they get the data
> into the backing bean before the page is displayed?
> >
> >
> >
> > Thanks
> >
> > Peter
> >
> > ________________________________
>  Yahoo! for Good
> > Click here to donate to the Hurricane Katrina relief effort.
> >
> >
> >
> > ________________________________
> Yahoo! for Good
> > Click here to donate to the Hurricane Katrina relief effort.
> >
> >
>
>


--

hicham ABASSI
habassi@gmail.com

Re: Getting data before a pages first call

Posted by Andrew robinson <an...@gmail.com>.
There is a really long topic on the Java forums on the "OnLoad" event that
can be found here:
http://forum.java.sun.com/thread.jspa?threadID=541382

On 10/3/05, Peter Miller <pe...@yahoo.com> wrote:
>
> Would someone please be so kind as to answer this question?
> I have read the archive of the mailing list and found a similar question
> before. But the answers did not help me much. They referred to the
> master/detail example but I still can't find the sources of the examples.
>  Where are those sources?
>  Thanks
>  Peter
>
>
> *Peter Miller <pe...@yahoo.com>* wrote:
>
>  Where do I find the sources of the MyFaces examples?
>
>  I want to find out how pages such as the masterdetail manage to load data
> into their backing bean BEFORE the page is rendered.
>
> I mean – it is easy to press a button which triggers a "get data" method
> and shows the results.
>
>  But how do I load data before a page is shown first? Through the
> constructor? Some "init" method?
>
>  I want to write a page that displays a list of items when it is called
> first. This page is the first page in the application so I can't get any
> button of a previous page to call a "get data" method.
>
> The data has to get into the backing bean beforehand. How?
>
>  The masterdetail example does the same thing. When it is called for the
> first time it displays a list of countries. But how do they get the data
> into the backing bean before the page is displayed?
>
>  Thanks
>
> Peter
>
> ------------------------------
> Yahoo! for Good
> Click here to donate <http://store.yahoo.com/redcross-donate3/> to the
> Hurricane Katrina relief effort.
>
> ------------------------------
> Yahoo! for Good
> Click here to donate <http://store.yahoo.com/redcross-donate3/> to the
> Hurricane Katrina relief effort.
>
>

Re: Getting data before a pages first call

Posted by Peter Miller <pe...@yahoo.com>.
Would someone please be so kind as to answer this question?
I have read the archive of the mailing list and found a similar question before. But the answers did not help me much. They referred to the master/detail example but I still can't find the sources of the examples.
 
Where are those sources?
 
Thanks
 
Peter
 


Peter Miller <pe...@yahoo.com> wrote:

Where do I find the sources of the MyFaces examples?

 

I want to find out how pages such as the masterdetail manage to load data into their backing bean BEFORE the page is rendered.

I mean – it is easy to press a button which triggers a “get data” method and shows the results.

 

But how do I load data before a page is shown first? Through the constructor? Some "init" method?

 

I want to write a page that displays a list of items when it is called first. This page is the first page in the application so I can’t get any button of a previous page to call a “get data” method.

The data has to get into the backing bean beforehand. How?

 

The masterdetail example does the same thing. When it is called for the first time it displays a list of countries. But how do they get the data into the backing bean before the page is displayed?

 

Thanks

Peter



---------------------------------
Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort. 
		
---------------------------------
Yahoo! for Good
 Click here to donate to the Hurricane Katrina relief effort.