> 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 <[EMAIL PROTECTED]> 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.
>
>

Reply via email to