cancel
Showing results for 
Search instead for 
Did you mean: 

Create Class and Package in Web Dynpro

Former Member
0 Kudos

Hi Buddies,

as a Java Programmer, I would like to create a Package and a Class in a Web Dynpro Application. What I mean is a simnple Class that contains Constants etc. that is independent of the "generated" classes...

Where can I do that and what are the best practices?

Thanks, Johannes

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Johannes,

You can create. You need to follow some steps:

1. Goto Web Dynpro Nevigator.

2. Right click on the packages folder and then New->Other-> Java -> Select Class or Package.

You can run java class from NWDS also and able to see the output without deploying the web dynpro application.

Goto Run->Run As->Java application.

Regards,

Deepak

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Switch to Navigator view.

Under the src folder you can create the classes as you do in Java perspective.

Regards

Ayyapparaj

Former Member
0 Kudos

To store Constants, is this the proper and common way to do it? Thanks, Johannes

Former Member
0 Kudos

Hi Johannes,

Yeah.

You can create a java class for constant and you can call the java class from Web dynpro by creating its object.

Regards,

Deepak

Former Member
0 Kudos

hey guys....thanks all...i thought it wasnt possible to use it that way...however....what could be call as a good practice....create the class within the WD package or create another DC for all utility related classes...since the latter helps in segregation of classess...i think the latter would be a better option....

Thanks,

GLM

Former Member
0 Kudos

If you need type-safe access you can define an interface with static final attributes representing the constants, or in JDK >= 5, use enums. Another option would be to use a property file.

In any case make sure to put your files under the src/packages folder.

Armin

Former Member
0 Kudos

What about this Interface?

IConstants

Seems to be defined by default in a Web Dynpro Project??

In fact, I was looking for a construct providing key, value pairs.. Is there anything out there?

Thanks, Johannes

Former Member
0 Kudos

Hi,

You can do it.

Goto File -> New -> Other -> Java -> Select Class or Package

Regards,

Swati.

Edited by: Swati Gaur on Aug 11, 2008 10:15 AM

Former Member
0 Kudos

I dont think that its possible to create a normal java class within a WD 4 JAVA project. However you could create a java project dc and use that dc within a WD dc and then call the classes you need.

My apologies its possible

Edited by: GLM on Aug 11, 2008 2:17 PM