This week's giveaway is in the Beginning Java forum.
We're giving away four copies of Bad Programming Practices 101 (e-book) and have Karl Beecher on-line!
See this thread for details.
Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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?
 
Sheriff
Posts: 23582
48
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.
 
Bartender
Posts: 19542
90
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".
 
See ya later boys, I think I'm in love. Oh wait, she's just a tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!