cancel
Showing results for 
Search instead for 
Did you mean: 

Error during a compilation of webdybpro java

Former Member
0 Kudos

Hi,

I'm new in webdynpro java and i try to do something and i certainly i have made a mistake.

You could see the screen about my compilation error here:

It's a simple example of the navigation on 2 view but i have add a condition for going on the second view...and it's after i have add this little custom code the builds generate errors...

[http://fdf.cod.free.fr/My_test.JPG]

[http://fdf.cod.free.fr/My_fisrview.JPG]

[http://fdf.cod.free.fr/the_code_i_have%20add.JPG]

Don't kno if it's an syntac error ( maybe i have to put << ...) or if i have to put this custom code on an other place.

Thx by advance.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Please check the "Tasks" view for errors. If there are any, try to correct them using the WD tools. In one of your screenshots, there appears an "Invalid controller usage" error for the component controller. Please fix this before writing code in the Java editor.

This is necessary because the code generation will not run as long as there are still errors in the metadata of your application.

To your other question. From the screenshot I guess there is a context node named "Person" with attributes "BeginDate" and "End Date", probably of type "date".

Before writing code, make yourself comfortable with the context API. Don't just guess the right code.

Here you probably want to have something like


Date beginDate = wdContext.currentPersonElement().getBeginDate();
Date endDate = wdContext.currentPersonElement().getEndDate();
if ( beginDate.before(endDate) )
{
  wdThis.wdFirePlugToDetailView();
}

Armin

Former Member
0 Kudos

OK now without my little code there is no error during a rebuild.

There is a node witch name is Person with BeginDate and EndDate like attributes.

I thought that like i have made the mapping of this node in my view that i have acces to Person.BeginDate naturally;and that i needn't writte this lines in my "view"implementation.

Date beginDate = wdContext.currentPersonElement().getBeginDate();

Date endDate = wdContext.currentPersonElement().getEndDate();

...but maybe i have to writte this code in an other place...

Edited by: Fabrice BABY on Feb 5, 2008 12:45 PM

Edited by: Fabrice BABY on Feb 5, 2008 12:46 PM

Former Member
0 Kudos

I don't understand your comment. The code I gave is the way to access context attributes using the context API. There is no syntax like <node>.<attribute>.

Armin

Former Member
0 Kudos

ok i understand.

i have say that because of that :

[http://fdf.cod.free.fr/explain.JPG]

Edited by: Fabrice BABY on Feb 5, 2008 1:03 PM

Former Member
0 Kudos

Ok, I understand too

The syntax you see in the "Properties" view or in the preview area is just a "pseudo-syntax" to describe (designtime) context paths. At runtime, you need an API to access the attributes inside specific node elements.

Armin

Former Member
0 Kudos

thx for this explain.

But where could i find the complete API? ( maybe in netviewer developer studio but i don't kno where exactly...)

Thx

Former Member
0 Kudos

Hey baby,

you write the following code in the action you want to trigger it to the next view.

Date beginDate = wdContext.currentPersonElement().getBeginDate();

Date endDate = wdContext.currentPersonElement().getEndDate();

if ( beginDate.before(endDate) )

{

wdThis.wdFirePlugToDetailView();

}

Note : Make sure that the data type of the Date is of type java.lang.Sql; but not of java.lang.Util;

Former Member
0 Kudos

thx

Former Member
0 Kudos

There are in fact two context APIs, the generic API (IWDNode, IWDNodeElement, etc.) and the typed API. The typed API is generated from the context definitions you made in the IDE and allows typed access to the context.

In your example, the typed API will contain interfaces and methods like

IPersonNode, IPersonElement, IPersonElement.getStartData() etc.

This is all described in detail in the book "Inside Web Dynpro for Java" by Chris Whealy.

Armin

Former Member
0 Kudos

Note : Make sure that the data type of the Date is of type java.lang.Sql; but not of java.lang.Util;

-> Where can i find this information?

Former Member
0 Kudos

What's the extra information of your post? Even the package names are wrong (java.lang.Sql, java.lang.Util).

Armin

Former Member
0 Kudos

The cited package names are wrong. You should in fact use java.sql.Date for attributes with designtime type "date". The mapping between designtime and runtime types is described here:

http://help.sap.com/saphelp_nw70/helpdata/en/42/c04c950ad21d65e10000000a1553f6/content.htm

Armin

Former Member
0 Kudos

Thx for all.

I'm going to read some doc now

Former Member
0 Kudos

HI baby,

Make sure that the comparator you have used in the " if " clause is a valid one ( i.e, the " < " ) for the date data type or not.

Former Member
0 Kudos

Ok but where can i find this type of information?

Thx.

Edited by: Fabrice BABY on Feb 5, 2008 11:47 AM

sridhar_k2
Active Contributor
0 Kudos

It seems to be problem, with compilation error.

if(true){

}

....it is written as

IF (////conditon){

}

Try to comment your condition and run the application, if it runs fine....check your condition statement.

You can get Examples in the SDN,

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/49f2ea90-0201-0010-ce8e-de18b94a...

Regards,

Sridhar