• Post Reply Bookmark Topic Watch Topic
  • New Topic

Invoking Methods in JSF 2.0

 
Prithvi Sehgal
Ranch Hand
Posts: 774
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am a new user to learn JSF, i am currently following Core Java Server Faces edition 3.0. I am reading second chapter and i came
across this example. I am quoting the code below


This particular bean is referenced in the following view page


When i see these statements,



When i scan the QuizBean, i don't find see any field named current or answer. Then what is it referring too.
Is it referring to the getCurrent() and getAnswer() methods?

Confused. Please help.




 
Tim Holloway
Bartender
Posts: 18414
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You must also be new to JavaBeans if you don't know about that one. You are correct. The set/get methods are accessors for the property with the corresponding name.

JavaBeans are used a lot of places, not just in JSF, so I recommend you speedily fill that particular gap in your education!
 
Prithvi Sehgal
Ranch Hand
Posts: 774
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim,

I think so i am not able to put my question clearly. First of all, i know what JavaBean is how they are used.

The main thing i was trying to ask is that, when we scan the POJO, we don't find any property by those name.
So if we say something like


It basically access the getCurrent() method in the bean. But in our case, the example presented above was only
having a read-only property so whenever i use some read-only property like that, it gives me an exception that
it is not able to access current property or NullPointerException. Though in the book, it says the example is working
fine. What should i do in such a context?

Hope i am able to put my question in a better narration this time.

Thanks,
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!