users@javaserverfaces.java.net

Re: Re: JSF 1.2_04: How do create a page that loads values from a database, the user edits the values and saves the values back to the database, then redisplay the same page with the new values?

From: Jason Lee <jason_at_steeplesoft.com>
Date: Thu, 5 Jul 2007 13:36:41 -0500

On 7/5/07, Todd Patrick <Todd.Patrick_at_dtn.com> wrote:
>
> Jason:
>
> I'm using a PL because I have view logic that depends on the data that is
> loaded.
>

I'm pretty sure @PostConstruct should work for that. I have a MB that has a
DAO injected, then acts on the DAO in a @PostConstruct method...

So, Unless I really don't know what I'm talking about - I thought the method
> with the PostConstruct annotation in a managed bean was ran only after all
> Phase Listeners had past?
>

Well, I'm not sure that's correct. I'd have to look at the code, but a
managed bean is instantiated the first time it is referenced (and any
@PostConstruct methods are then called). Since a MB can be referenced
inside a PL using the various JSF and EL APIs, I don't think it's correct to
say that @PostConstruct runs after the PLs. I've been wrong before,
though... ;)


> As I test this page, it seems to be working, but this probably isn't the
> best approach, eh?
>

There's a lot to be said for a working solution. ;)

-- 
Jason Lee, SCJP
Software Architect -- Objectstream, Inc.
JSF RI Dev Team
http://blogs.steeplesoft.com