开发者

Getters and Setters In ManagedBean

I have JSF page with no dataTables, only textfields and buttons and corresponding java classes.

I have created a class called A with getters and setters with constructors and another class called B for all data retrieval and data insertions In my faces-config.x开发者_如何学编程ml I have defined second class (B) as managedbean, not the first one with getters and setters. If that's the case do I need to repeat all the getters and setters in class B, so that I could refer in jsf page like #{b.getId}?

What is the best approach?

I am referring to this example for reference. http://balusc.blogspot.com/2006/06/using-datatables.html

Thanks


You can define a method getA in b that returns an object of type a. You can use the object you get from getA in your JSF like this:

#{b.A.Id}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜