Jon
Does anyone know if there is a recommended way to have a bean method
executed before a JSF page is loaded? For example, I have a page with a
h:dataTable in it. What I want to do is make it so that when a user brings
up the page directly (by entering the URL in the browser text box rather
than as the result of submitting a form), a bean method is executed which
does a query to a database. I want the bean to be populated before the page
is rendered. Currently, I'm doing this using a servlet filter. However, one
problem with this is that Faces isn't initialized at this point. This isn't
a big issue, but, one issue that I ran into is that I was using a managed
bean and that bean might not have been created by Faces when the filter
executes. So, I put some code in to test if the bean is null or not and it
creates it if necessary. I'm wondering if there is a more recommended way to
do this within the context of Faces itself. i.e. maybe using a listener or
something? Note, I only want the code to execute for a specific page. It
seems like there should be some kind of onInit() method that could be
overriden to perform initialization before a page is renderered... I don't
know much about ASP.NET, but, I think it allows you to do something like
this. I guess I could use a scriptlet in the JSP to do it.
- Re: How to execute bean method before JSF page is loa... Jonathan Eric Miller
- Re: How to execute bean method before JSF page i... David Gadbois
- RE: How to execute bean method before JSF page i... Korhonen, Kalle
- Re: How to execute bean method before JSF pa... Jonathan Eric Miller
- Re: How to execute bean method before JS... Craig McClanahan
- Re: How to execute bean method befor... Sean Schofield
- RE: How to execute bean method before JSF page i... Korhonen, Kalle
- RE: How to execute bean method before JSF page i... gvanmatre
- Re: How to execute bean method before JSF pa... Matthias Wessendorf
- Re: How to execute bean method before JS... Sean Schofield
- Re: How to execute bean method before JSF page i... Ray Clark

