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 in开发者_如何学运维put.
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
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
For more JIRA-specific information and examples, take a look at the Webwork sample at https://plugins.atlassian.com/plugin/details/17189
"This plugin is a collection of working samples demonstrating how JIRA web pages are generated using JSP, Webwork1 and Velocity template files. Note: this plugin requires you to download the source and build it yourself."
I'm the author of the plugin.
~Matt
精彩评论