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

JSF EJB project problem  RSS feed

 
thomas jacob
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to implement a simple JSF -eJB project in vain.

I have a Session EJB which exposes a local interface method public List<TableBean> getTables(). I am calling the Session EJB in the JSF Managed Bean and want to display the list of Table Beans in the selectOneListbox component. Please guide how to design the JSF managed bean and JSF page. I am basically struggling to converting the List of TableBeans provided by Session EJB to show up in the selectOneListBox JSF component



Session EJB Local interface



Table Bean Data Object



JSF Managed Session Bean




JSF Page


 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"TablesMBean" is an unfortunate choice of names. I realize you probably mean "Managed Bean", but "MBean" is a convention for beans supporting the Java Management Extensions (JMX), which is quite something different. For whatever pedantry it's worth, "Managed Bean" refers more to how the bean is used than to what the bean specifically is. So I just normally call them "Bean".

If you'll notice, you're creating a list of SelectItem and then not doing anything with it. The selectOneListBox and its relatives cannot directly access a collection, because the HTML equivalent requires name/value pairs, not single items - although frequently the name and value are identical. So the SelectItem class provides a wrapper for a name/value pair. You need to supply functionality to take the collection object and render it as an equivalent list or array of SelectItem. And, of course, to reference the SelectItem sequence on the View.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!