|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Visual Web Designer: Bind an EJB3 entity bean to a dropdown listHello.
I'd like to know if there is a way to bind an EJB3 entity bean (or rather a collection or array thereof) to a dropdown list (comboboy) in the JSF visual web designer. I have tried the tutorials and there it is only explained how to bind an entity bean to a table. The other tutorial only explains how to use a DataProvider to bind the database table data to a dropdown list. Is there some information on how to do that with using EJB3 entity beans? E.g.: I have a stateless session bean that has a getAll() method and returns all the entries from one database table in form of a List<MyEntityBean>. I can access that session bean from my JSF app and the list is also returned, but I don't know how to tell the page in the visual web designer that I want that list in the dropdown list with the entity's id as the value and one of it's string attributes as the displayed value. Thanks in advance. Kind regards. |
|
|
|
|
|
Re: Visual Web Designer: Bind an EJB3 entity bean to a dropdown listOn 16/01/2008, thompsonwd40@... <thompsonwd40@...> wrote: Hello heapifyman, |
|
|
Re: Visual Web Designer: Bind an EJB3 entity bean to a dropdown listPanagiotis Halatsakos wrote:
> check this blog entry for insights: > http://weblogs.java.net/blog/pkeegan/archive/2007/10/binding_jcombob.html I love it when people link to my blogs. Unfortunately, this one is about Swing beans binding, which is somewhat different than binding in JSF. -Patrick > > > On 16/01/2008, *thompsonwd40@... > <mailto:thompsonwd40@...>* <thompsonwd40@... > <mailto:thompsonwd40@...>> wrote: > > Hello heapifyman, > Sorry to not answer you directly, but I found a fantastic JSF blog > written by a fellow called BalusC - while you are waiting for a > reply here, check out: > http://balusc.blogspot.com/2007/12/action-dependent-requireness.html > along with his other postings -- great stuff! I hope this helps! > > Best, David > > -------------- Original message ---------------------- > From: heapifyman <heapifyman@... <mailto:heapifyman@...>> > > Hello. > > > > I'd like to know if there is a way to bind an EJB3 entity bean (or > > rather a collection or array thereof) to a dropdown list > (comboboy) in > > the JSF visual web designer. > > I have tried the tutorials and there it is only explained how to > bind an > > entity bean to a table. > > The other tutorial only explains how to use a DataProvider to > bind the > > database table data to a dropdown list. > > > > Is there some information on how to do that with using EJB3 > entity beans? > > E.g.: I have a stateless session bean that has a getAll() method and > > returns all the entries from one database table in form of a > > List<MyEntityBean>. I can access that session bean from my JSF > app and > > the list is also returned, but I don't know how to tell the page > in the > > visual web designer that I want that list in the dropdown list > with the > > entity's id as the value and one of it's string attributes as the > > displayed value. > > > > Thanks in advance. > > Kind regards. > > |
|
|
Re: Visual Web Designer: Bind an EJB3 entity bean to a dropdown listYou can create an objectListDataProvider like this
public class MyDataProvider extends ObjectListDataProvider { private ArrayList list; public MyDataProvider () { MyEntityBean entityBean= new MyEntityBean(); list = new ArrayList(); list.add(entityBean); setList(list); } } you the go to sessionbean1 and create a reference to the dataprovider as a property: private MyDataProvider myData = new MyDataProvider(); create the getter and setter You should now be able to access the dataprovider for binding to the dropdown. right click the dropdown and go to property bindings > options . Select the value and display properties. in your code your can then load the list as follows: (you wrote:I have a stateless session bean that has a getAll() method) getSessionBean1().getMyData().setList(getStatelessSessionBean.getAll()); and this would set the options for your dropdown list regards
|
|
|
Re: Visual Web Designer: Bind an EJB3 entity bean to a dropdown listSorry!
:| I haven't gotten into JSF yet (and probably won't because I am a PHP guy when it comes to web) But I found it very useful for the binding of drop down menus, I get to do a little thread hijacking and saying thanks for that article. On 17/01/2008, Patrick Keegan <Patrick.Keegan@...> wrote: Panagiotis Halatsakos wrote: |
|
|
Re: Visual Web Designer: Bind an EJB3 entity bean to a dropdown listthompsonwd40@... schrieb:
> Hello heapifyman, > Sorry to not answer you directly, but I found a fantastic JSF blog written by a fellow called BalusC - while you are waiting for a reply here, check out: http://balusc.blogspot.com/2007/12/action-dependent-requireness.html > along with his other postings -- great stuff! I hope this helps! Thanks, that sent me in the right direction. |
| Free embeddable forum powered by Nabble | Forum Help |