You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by an...@magnasteyr.com on 2005/12/06 16:12:21 UTC

Execute method automatically after page has been loaded and shown to user

Hi All!

How can I execute a method from a backing bean AUTOMATICALLY after a page has been loaded and shown to the user?

My exactly problem is the following: 
When the user opens the first page, this page should be shown normally (and quickly) to the user. In the background the connection to the database should be build (automatically, no button should be pressed) -->I use Hibernate and the first connection (building of connection pool) takes some seconds, so this should be done in background, but the user should already see something in his browser (with an info, that the connection to the database is just built)
Is there a possibility to do that?

Thx

Regards
Andy

______________________________________________________________________

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
your system manager.
 
This footnote also confirms that this email message has been swept
for the presence of computer viruses. 
______________________________________________________________________

Re: Execute method automatically after page has been loaded and shown to user

Posted by Mike Kienenberger <mk...@gmail.com>.
Andy,

There's many ways to do this.

Some ways you could do it:

1) Use the Shale ViewController stuff to define your backing bean to
be the controlling bean for your page.  It'd be able to receive events
like pre-render and post-render.

2) Create a phase listener that ran at pre-render and post-render phase.

3) Use a servlet filter -- this is how I manage my database
connections, but I have need for my database connection to be active
at all phases of JSF.

On 12/6/05, andreas.mitter@magnasteyr.com <an...@magnasteyr.com> wrote:
>
>
> Hi All!
>
> How can I execute a method from a backing bean AUTOMATICALLY after a page
> has been loaded and shown to the user?
>
> My exactly problem is the following:
> When the user opens the first page, this page should be shown normally (and
> quickly) to the user. In the background the connection to the database
> should be build (automatically, no button should be pressed) -->I use
> Hibernate and the first connection (building of connection pool) takes some
> seconds, so this should be done in background, but the user should already
> see something in his browser (with an info, that the connection to the
> database is just built)
>
> Is there a possibility to do that?
>
> Thx
>
> Regards
> Andy
> ______________________________________________________________________
> This email and any files transmitted with it are confidential and intended
> solely for the use of the individual or entity to whom they are addressed.
> If you have received this email in error please notify your system manager.
> This footnote also confirms that this email message has been swept for the
> presence of computer viruses.
> ______________________________________________________________________
>