cancel
Showing results for 
Search instead for 
Did you mean: 

where to write common code for accessing data using Java API

Former Member
0 Kudos

Hi Friends,

I visited some examples in webdynpro application examples provided by SDN.

in one example for context programming(number 18), the Java code to access the data is in Controller context , but in another example (number 11) its in context of a view.

I understand that if the data need not to be on controller level, it can be placed on View context level.

Is there any other reason also to put Java code/implementation on view context level, instead of Controller context level?

Accepted Solutions (0)

Answers (2)

Answers (2)

pravesh_verma
Active Contributor
0 Kudos

Hi Naveen,

There are various points where you have to decide where to put which code. If your code is only the interaction between the screens (ie: the action based on some selection of dropdown, some action of inputing the value in InputFeild and press enter, like that..), then tehe code must be written in the view context.

The code which need to be accessed by different modules of the appication then that code must be written in the controller context. For eg: (Creation of the connection with the backend, Getting some initial data from Backend) its always better to keep the view code for the UI based purposes, otherwise it will effect the rendering time of the screen. More the code in the view context more will be the rendering time. So this can lead to a bad impact for end user actually using the screens.

I hope this helps you!! If any further information required then kindly revert back.

Regards

Pravesh

PS: Please consider rewarding points if helpful and solved.

sridhar_k2
Active Contributor
0 Kudos

Hi Naveen,

You can place java code in Controller, View or in a Helper Class to access Data.

If your Data accessing code is there in more than two views, keep that code in controller and access it from there.As WebDynpro is on MVC architecture, it is a good practice to keep data accessing code in Controller.

Regards,

Sridhar