cancel
Showing results for 
Search instead for 
Did you mean: 

How to access webdynpro view attributes

Former Member
0 Kudos

Hi Friends,

I want to access the input fields of view in view controller or component controller in Java webdynpro application.

Accepted Solutions (1)

Accepted Solutions (1)

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

In java.........

Here we are accesing the attribute called NAME from the MAINCOMPONENT component controller context.




		String s = null;

		s
			= wdThis
				.wdGetMainComponentController()
				.wdGetContext()
				.currentContextElement()
				.getName();



Regards,

Rich Heilman

Former Member
0 Kudos

Thanks Rich!

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi ,

I have one question here.

If I map the view context value attributes with controller context attributes, I get a problem.

that is :-

suppose I have iView for search fields with view controller then I get search results, in another view.. all are in same viewset.

so:-If my value attributes are same in component controller context and view context, the fields in input fields will be filled up with the values which are populated as search results data .

for that:- I shoudl either maitain different fields for search input and search results. I can not reuse my fields of component controller context.

please advise better way.

Former Member
0 Kudos

Hi

Do you want to access InputField or the value attribute assigned to it?

If you want to access the InputField in your view then you can access it by using following code in wdModifyView() method of your view controller.

IWDInputField ipfield = (IWDInputField) view.getElement("input_field_id");

String input_field_id denotes the id of your input filed.

Using ipfield object you can perform various operations on InputField.

In case you want to access the Value attribute assigned to the InputField value property then you can access it using following code in your view controller:

wdContext.currentContextElement().get<AttributeName>();

If you want to acces these attributes in Componenet Controller then you create the same attribute in Component Controller.In the properties tab of your view you will have the table for adding required controllers.There you add Component Controller.

Now you go to context tab and there you select this attribute and right click.Select edit binding.Now you can select the same attribute from the component Controller.Thus the attributes in view controller and Component Controller are mapped.

Now you can access this attribute in Component controller using following code:

wdContext.currentContextElement().get<AttributeName>();

Regards,

Ajay

Former Member
0 Kudos

Thanks Ajay.