First off, note that this is a filter, not a listener.   That means
you can "open" before the request and "close" after the request, for
whatever meaning "open" and "close" have to your database layer.

As for leaving connections open and dealing with timeouts, that's
going to depend on your database layer.

On 12/7/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi Mike!
>
> I like the idea with the Servlet Listener,but I see one problem:
> The database connection is already openened when the Application Server is 
> started
> -So could there be a problem with database connection timeouts? What happens, 
> when the database returns a timeout.
> -If no timeout happens, isn't it a bad approach to let the connection open 
> all the time, because database connection are expensive as long as I know?
>
> What do you think about my thoughts?
>
> Regards
> Andy
>
> -----Ursprüngliche Nachricht-----
> Von: Mike Kienenberger [mailto:[EMAIL PROTECTED]
> Gesendet: Dienstag, 6. Dezember 2005 17:22
> An: MyFaces Discussion
> Betreff: Re: Execute method automatically after page has been loaded and
> shown to user
>
>
> 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, [EMAIL PROTECTED] <[EMAIL PROTECTED]> 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.
> > ______________________________________________________________________
> >
>
>
> ______________________________________________________________________
>
> 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.
> ______________________________________________________________________
>

Reply via email to