cancel
Showing results for 
Search instead for 
Did you mean: 

Is this possible in Web Dynpro Java?

Former Member
0 Kudos

Hi,

Please check if this can be done in Web Dynpro Java...

public class TestFunction {
	boolean bool =false;
	
	boolean Test1()
	{
		bool= true;
		return bool;
	}
	
	void takeBool(boolean b){
		b=this.bool;
		System.out.println("The value of bool "+bool);
	}

	public static void main(String[] args) {
		TestFunction tf = new TestFunction();
		boolean c=tf.Test1();
		tf.takeBool(c);
	}
}

Regards

Kaushik Banerjee

Edited by: Kaushik Banerjee on Sep 1, 2010 8:00 PM

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I did it.

But I am doing unit Testing of the code.

Regards

Kaushik Banerjee

Former Member
0 Kudos

Hi,

Just to add to the post.

I have a Web Dynpro Java View where I need to validate all input fields

and if the validation; I will call the update RFC.

I want to do the same logic.

Write two methods in the Web Dynpro Java;

1> Method 1 would return a flag variable 1 or 0.

1 would be returned if the validation is true.

0 would be returned if the validation is false.

2> Method 2 would have parameter type int where we need to

send the values 1 or 0.

If the value is 1, I would call the update RFC

or I would not call the Update RFC.

Flag Variable would be declared as Global Variable in Begin Others and End.

One doubt in web dynpro method parameter we can send an integer;

also we can return integer.

What is the difference between int and integer ?

I know Integer is a wrapper class in Java.

Regards

Kaushik Banerjee

Former Member
0 Kudos

In Web dynpro you can write regular java. Of course you can create 2 methods like this. There can't be any "main()" function though.

For global variables you can use the context and set the variables in your code.

Yes Integer is a Class and int is a primitive parameter. You can send and return Interger of course.

Former Member
0 Kudos

Further to what Faraz has said, Web Dynpro can be seen as an implementation of the Framework pattern.

Essentially you write normal Java code with access to various Java objects exposed/generated by the Web Dynpro Framework inside "hook" functions.

The Web Dynpro framework then calls your functions at various stages when the page renders and when actions are triggered.

For a high level understanding of this, not specific to Web Dynpro, research the concept of OO Frameworks pattersn.

for example [Article explaining frameworks|http://www.cs.wustl.edu/~schmidt/CACM-frameworks.html]

Here is an excerpt from the above article which highlights the major points

The primary benefits of OO application frameworks stem from the modularity, reusability, extensibility, and inversion of control they provide to developers, as described below:

Modularity -- Frameworks enhance modularity by encapsulating volatile implementation details behind stable interfaces. Framework modularity helps improve software quality by localizing the impact of design and implementation changes. This localization reduces the effort required to understand and maintain existing software.

Reusability -- The stable interfaces provided by frameworks enhance reusability by defining generic components that can be reapplied to create new applications. Framework reusability leverages the domain knowledge and prior effort of experienced developers in order to avoid re-creating and re-validating common solutions to recurring application requirements and software design challenges. Reuse of framework components can yield substantial improvements in programmer productivity, as well as enhance the quality, performance, reliability and interoperability of software.

Extensibility -- A framework enhances extensibility by providing explicit hook methods that allow applications to extend its stable interfaces. Hook methods systematically decouple the stable interfaces and behaviors of an application domain from the variations required by instantiations of an application in a particular context. Framework extensibility is essential to ensure timely customization of new application services and features.

Former Member
0 Kudos

... continued

Inversion of control -- The run-time architecture of a framework is characterized by an inversion of control. This architecture enables canonical application processing steps to be customized by event handler objects that are invoked via the frameworks reactive dispatching mechanism.

When events occur, the frameworks dispatcher reacts by invoking hook methods on pre-registered handler objects, which perform application-specific processing on the events. Inversion of control allows the framework (rather than each application) to determine which set of application-specific methods to invoke in response to external events (such as window messages arriving from end-users or packets arriving on communication ports. )

Former Member
0 Kudos

Hi,

Just to add to the post.

I have a Web Dynpro Java View where I need to validate all input fields

and if the validation; I will call the update RFC.

I want to do the same logic.

Write two methods in the Web Dynpro Java;

1> Method 1 would return a flag variable 1 or 0.

1 would be returned if the validation is true.

0 would be returned if the validation is false.

2> Method 2 would have parameter type int where we need to

send the values 1 or 0.

If the value is 1, I would call the update RFC

or I would not call the Update RFC.

Flag Variable would be declared as Global Variable in Begin Others and End.

One doubt in web dynpro method parameter we can send an integer;

also we can return integer.

What is the difference between int and integer ?

I know Integer is a wrapper class in Java.

Regards

Kaushik Banerjee