File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes 3 problems of JSF Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "3 problems of JSF" Watch "3 problems of JSF" New topic

3 problems of JSF

liliane fahmy

Joined: Aug 24, 2012
Posts: 22
I am facing 3 problems in my program:

1-As I know that valueChangeListener was fired in the Process Validations phase before Update Model
Values phase is this true?
My problem is that the managed beans were updated before the valueCahngeListener was fired.
So I want to update the model after the valueChangeListener was fired.How do this?

2-When I call managed bean from another,it got nullPointerException although I declare ir in face-config.xml as follows:

and in the backing bean class:

What I can do to solve this?Has it something missing?

3-How to change the values of HtmlSelectoneMenu programmaticaly?

Please I want help

Thanks and best regards
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

In the normal order of operations, you should not be manually updating the Model. The JSF Controllers do that automatically at Update Model time. In particular, valueChangeListeners shouldn't be used to update the Model in place of the normal update mechanisms.

ValueChangeListeners also shouldn't contain business logic. Put that in the Action method, instead. At the time the action method is invoked, the Model will be stable with all updates applied.

I can't tell why you seem to have a problem with the Managed Property. However, technically speaking a bean doesn't "call" a bean, and in particular, the proper terminology here is that "tripBean" is injected into the target bean.

A very common mistake that JSF newbies make is that they want their JSF code to "do" things and to "get" stuff to do it with. JSF is architected around the concept of Inversion of Control (IoC), where you don't go after good things, the good things come to you without being asked for. If you're not familiar with IoC and how it interacts with POJOs, I recommend studying it. Things will make a lot more sense.

An IDE is no substitute for an Intelligent Developer.
liliane fahmy

Joined: Aug 24, 2012
Posts: 22
Thanks for your reply .

Would you please send me a topic which explain
how to inject a managed bean as properties ,and the rules of its scopes.

Thank you
Frankely Diaz

Joined: Oct 09, 2009
Posts: 20

You can inject beans using managed property annotation .
I agree. Here's the link:
subject: 3 problems of JSF
It's not a secret anymore!