954,600 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Backing Bean question

I'm newbie to JSF and i am confused on this portion written by Cay Horstmann in the Core Java server faces:

=======================================================================================

The code:

public class QuizFormBean { 
private UIOutput scoreComponent; 
private UIInput answerComponent; 
// PROPERTY: scoreComponent 
public UIOutput getScoreComponent() { return scoreComponent; } 
public void setScoreComponent(UIOutput newValue) { scoreComponent = newValue; } 

// PROPERTY: answerComponent 
public UIInput getAnswerComponent() { return answerComponent; } 
public void setAnswerComponent(UIInput newValue) { answerComponent = newValue; } 
... 
}


=====================================================================================

This is the 2nd edition of this book.

When you use a backing bean, you need to wire up the components on the form to those on the bean. You use the binding attribute for this purpose:

When the component tree for the form is built, the getScoreComponent method of the backing bean is called, but it returns null. As a result, an output component is constructed and installed into the backing bean with a call to setScoreComponent.

Question:

if this is correct .. why another output component is created? I dont see the need since a backing bean is both ways - input and output.


==================================================================================

This is the 3rd edition of this book.

When you use a backing bean, you need to wire up the components on the form to those on the bean. You use the binding attribute for this purpose:

When the component tree for the form is built, the getAnswerComponent method of the backing bean is called, but it returns null. As a result, an output component is constructed and installed into the backing bean with a call to setAnswerComponent .

Question:
If this edition is correct, shouldn't this be input component since answerComponent is of type UIInput?

yapkm01
Newbie Poster
24 posts since Aug 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: