Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing data from the bean class to a class/object returns null  RSS feed

 
fredy salgado
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to pass a question to setQuestion in the bean class, with a tester. The thing is when I do a system out from the other class (Question) in the tester, it returns a null.

The bean class



The class (Question) where I want to pass the String



Tester



Is there something that I'm missing out? Maybe something about JSF and the bean class that I don't know?
 
Paul Clapham
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That code sample should return "-----> null" as far as I can see. Is that not what's happening?
 
fredy salgado
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul Clapham wrote:That code sample should return "-----> null" as far as I can see. Is that not what's happening?


Correct. That's what it is returning.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "set" methods of JSF backing beans are not invoked automatically. You either have to inject @ManagedProperty into them or define them as managed properties in the faces-config.xml file.

But also Rule #2 of JSF: "Request scope in JSF is almost entirely useless".
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!