on 11-03-2009 10:13 AM
Hello together.
I've wrote an EJB in which is a method that read out a DB Table XYZ. In this EJB also are methods to search a single entry.
In my WebDynpro applixcation i have a method in the Component that access the EJB and retrive the single entry for example. In the View implemantation i call the method from the "WEbDynPro component" which have a string as return type.
Is it possible to have an object as return type?
public java.lang.String sr( int KVNR )
{
//@@begin sr()
KVNummerDTO kvnrObject = new KVNummerDTO();
String Kasse = "";
try
{
KVNRSessionLocal kVNummerSessionLocal = kVNRSessionLocalHome.create();
kvnrObject = kVNummerSessionLocal.getKVNummer(KVNR);
Kasse = kvnrObject.getKasse();
}
catch (Exception e)
{
e.printStackTrace();
wdComponentAPI.getMessageManager().reportException(e.getMessage(), true);
}
return Kasse;
//@@end
}
I want to return kvnrObject and not only a string!
Hello Micheal,
While Creating a method in front of the return type click on the browse and select Java Native Type Radio Button and again click on the browse button available there. Type the name of the class in the class in it and you can select the return type. If it is a user made class then first the required Java files under the path Resources>src>packages><create a folder>java file. Then build the project so that the class name is visible in list while selecting the return type.
Regards,
Ardhendu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Micheal,
When you select the return type of type Object in NWDS 7.1 there is Check Box available to determine whether it is a array Type. Just Check the box the return type will be array of that object. Check if same is available in NWDS 7.0
Regards,
Ardhendu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Micheal,
Yes you can have an Object of return type. Just select the Java Class name while creating a return type and you can have object of that class as the return from method. Either way you can set the value to the Context Attribute of that type in the Method and the same can be used in the Other method within the Web Dynpro application.
Regards,
Ardhendu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Maybe that was not supported in older releases (which release are you using?). Isn't there a "Browse..." button at the "Return Type" selection of your method editor?
As an alternative you could also define a context attribute of your Java native type and put the method result into that attribute. Using context mapping, a view controller can then access this value.
Armin
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.