Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

3 problems of JSF

 
liliane fahmy
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18156
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
liliane fahmy
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 20
Eclipse IDE Java jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


You can inject beans using managed property annotation .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic