on 03-13-2007 7:15 AM
i have a method which return a collection
Command Bean
public getResult(){
Collection newcol=new ArrayList();
bean.setxxx(xxx);
bean.setxxx(xxx);
bean2.setxxx(xxxx);
bean2.setxxx(xxxx);
newcol.add(bean);
newcol.add(bean2);
return newcol;
}
webdynpro
public void init(){
col=getResult();
wdContext.nodeEmailOutCommandBean().bind(col); //bind to bean
wdContext.nodeEmailOutDetailsCommandBean().bind(col); //bind to bean2
}
how can i do this...
Message was edited by:
yzme yzme
maybe my question is not clear
i bind to a model bean..
i have a method which return a collection
Command Bean
public getResult(){
Collection newcol=new ArrayList();
bean.setxxx(xxx);
bean.setxxx(xxx);
bean2.setxxx(xxxx);
bean2.setxxx(xxxx);
newcol.add(bean);
newcol.add(bean2);
return newcol;
}
webdynpro
public void init(){
col=getResult();
wdContext.nodeEmailOutCommandBean().bind(col); //bind to bean
wdContext.nodeEmailOutDetailsCommandBean().bind(col); //bind to bean2
}
what i want is if i bind to nodeEmailOutCommandBean I WANT TO GET BEAN
if i bind to nodeEmailOutCommandBean I WANT TO GET BEAN2
in array i can use...
ArrayList arr=new ArrayList;
if (arr.get(0) instanceof Bean){
........
}else if(arr.get(0).instanceof Bean2){
.....
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can u please tell me steps clearly for gettting the collection from the bean class
my code is like this
public class SimpleData
{
private String name=null;
private String number=null;
Collection c=new ArrayList();
public Collection getCollectionData()
{
SimpleView sv1=new SimpleView();
sv1.setName("abc");
sv1.setNumber("xtz");
c.add(sv1);
SimpleView sv2=new SimpleView();
sv2.setName("aaaaaaaaa");
sv2.setNumber("bbbbbbbbb");
c.add(sv2);
return c;
}
public void setName(String name)
{
this.name=name;
}
public void setNumber(String number)
{
this.number=number;
}
public String getName()
{
return name;
}
public String getNumber()
{
return number;
}
}
i know how to create a model
but i am not getting how to create relationship for list methods
after how to bind can u please tell me quickly
Hi,
Create a Value Node of cardinality 0..n
under which create a value attribute and change the type to your Bean Class.
You can use your code now...
Regards
Abhimanyu L
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<i>Create a Value Node of cardinality 0..n</i>
Wrong. It's necessary to create a model node. But first it's necessary to import JavaBean model. Then add this model to component and only afterwards create Model Node with model class that correspond to JavaBean.
Valery Silaev
SaM Solutions
Abhimanyu,
In original question author tries to bind collection of model objects to node. This is only possible for model node. To use model node it's mandatory to have model -- like Adaptive RFC Model, or WS model, or JavaBean model in this case. So model import is mandatory here.
Sure, it's possible to use value node and copy attribute values back and force many times. This leads to data synchronization problems (between node elements and model objects), this provokes writting repetative code and so on. In general, I would highly recommend using model nodes when you need to "bind" UI to your model objects.
Valery Silaev
SaM Solutions
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.