Main Menu
Lecture 1
Lecture 3
Lecture 4
Lecture 5
Lecture 6
Lecture 7
 

 

 

Keys inside objects

We have put keys in the main object

We can also put keys inside the application and session objects

The value of a key inside the application object persists for the life of the application.

The value of a key inside the session object persists for the current user session.

Accessing an application

i.e. How to get the application instance from a session or a component

Application returns an object of type WOApplication

Have to typecast because your class uses a subclass

Remember to always check your type casting.

//Get an instance of the current application
Application app = (Application)Application.application();

/*Call a method inside your Application class without making an instance of it */
((Application).Application.application().yourmethod();

Accessing a session

Session returns an object of type WOSession

Once again you will have to typecast because your class uses a subclass

Rember to always check your type casting.

//Create an instance of the current session
Session ses = (Session)session();

//Call a method inside the current session without making an instance of it
((Sesssion).session()).yourmethod();