javajirawebwork

Webwork actions, the lifecycle of variables declared in the action class


I'm using the webwork framework (JIRA plugin development) and was wondering about the lifecycle of the variables in the action class.

I have a few private variables in the action class that are set when during the doDefault() method.

These are used in the input view to set up jqGrid columns and then when the user has entered some data they click submit which puts the grid data into a hidden input.

The next thing that happens is the doValidation() method is called before the doExecute(), which displays the input view if there are any errors.

The problem is that the variables set up in the doDefault() method are now null.

Can anyone explain to me how the lifecycle of variables works in the webwork actions?

Cheers


Solution

  • The action is not stored between invocations. You'll need to perform those calculations again or store them somewhere (in the page or in the session).

    Basic lifecycle:

    Browser requests page -> action created -> action returns result -> result page returned to browser