cancel
Showing results for 
Search instead for 
Did you mean: 

Executing Code on Application startup

tom_cole3
Explorer
0 Kudos

I have a web dynpro application that starts a TimerTask which causes the application to be run every 60 seconds. It works well but I want this TimerTask to start whenever the application is started.

I have added a <start-up mode="always"/> tag to the application-j2ee-engine.xml file for the application and it appears to start the application anytime the server is restarted as expected. However, the code to start the TimerTask isn't executed until the first time the application is ran. From then on, it works fine.

The code that initiates the TimerTask is in the Component Controller's wdDoInit method. But apparently this is not called at application startup, only the first time the application is loaded into a window.

Is there somewhere I should put code that I want executed each time an application is started? Any help would be appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Tom,

I don't think Web Dynpro is the right tool for doing this. Web Dynpro is a programming model for user interfaces. I think you would need to build is a J2E(E)-application

J

Answers (1)

Answers (1)

former_member214651
Active Contributor
0 Kudos

Hi Tom,

wdDoInit gets executed only once in the application's life time, If u need this to get executed every time the screen is loaded, then try writing the same code in the wdDoModifyView part of the view which is triggered every time a change is made on the screen.

Regards,

Poojith MV

tom_cole3
Explorer
0 Kudos

Thanks, but I think I did not clearly state my issue. Having the code run only once on the very first load is perfect. My question was is there any way to get the code run as soon as the NWAS starts the application, and NOT only when the screen is loaded for the first time? I would like the TimerTask to get initiated everytime the server boots up, not requiring human intervention...

Thanks.