cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Java Bean Model in Wed Dynpro

Sharathmg
Active Contributor
0 Kudos

Hello All,

I have to develop a WD Java application with an Oracle DB as the backend. To application was designed to abstract the backend interaction into a Java bean model. The data connection and retrieval was successful. To move the data to the context following steps were performed:

1. Create a java class with the variables to be used as context in the application. Ex: Name, Subject, Email

2. On interting the ResultSet, set the values to the variables.

But, only the last row of data is retained. We tried to use array but have not been able to move the ste of values to the context.

Request your help in this regard to store the set of values into the context.

Thank you.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

It looks like you are overwriting the same context element when populating it with the values from the resultset.

Make sure you create every time a new context element and add it to the context root.


while (rs.hasNext()) {
    ContextElement elem = new ContextElement();  // or something simular appropiate to your element
    elem.setName(rs.next().getName());
    contextRootNode.addElement(elem);
}

Hope this helps a little.

Regards,

Alain

Sharathmg
Active Contributor
0 Kudos

Dear Alain,

The issue is not in the WD. The data is to be moved to the variables in the Java bean. later it would be directly mapped to the component.

So, the issue we are facing is in the Java Bean where we code to set the values to the properties. There properties are exposed as context variables othe bean modeal later. We are trying to have an arraylist as property so that the data can be maintained in array but have been unsuccessful so far.

Thank you.

Sharath M G

Former Member
0 Kudos

Hi Sarath,

The java native types in your bean model class attributes will be automatically recognized in WD Model. But If you have any Class as attributes in bean model class then they have to be manually mapped so that WD recocnizes them . Check this

/people/balaramnaidu.bankuru/blog/2006/04/23/importing-complex-javabean-model-into-webdynpro-by-creating-relationships-for-the-model-classes

Regards

Srini

Sharathmg
Active Contributor
0 Kudos

Hello Srinivas,

Thank you the sharing the weblog. It solved the issue.

The problem was in defining the relations in in the java bean model.

Thank you everyone for your suggestions.

Regards,

Sharath M G

Answers (1)

Answers (1)

Former Member
0 Kudos

hi

you can go through this blog and write a simple jave bean application

/people/ignacio.hernndez/blog/2007/01/14/web-application-development-focus-java--study-guide

Thanks