[Opensource] Re: State interface
BSC
bsci at lycos.com
Thu Mar 6 21:44:24 PST 2003
>>>
So you don't use per-state forms? The Expresso Workflow and Forms doc
suggests that each state in a controller would have a subset of the
controller form in a particular form, to help isolate states from each
other. So, if a StateForm is a ControllerForm, there's no way to isolate
states at all, right?
And so, for every controller I write, should it have an ActionForm in
the struts-config.xml?
roberto
>>>
Roberto
Every controller (use case) that gathers user input should have an ActionForm in the struts-config.xml. This form would contain all the data gathered from the user before it is applied to the database. If this is a multi-page (wizard) controller then the 'scope' attribute in your struts config should be set to 'session'. You would then have something like this in your controller:
promptState = new PromptSpecifyDevice1("prompt1", "Add Device");
handleState = new ValidateSpecifyDevice1("handle1", "Add Device");
addStatePairing(promptState, handleState, null);
Notice the 'null' parameter in addStatePairing. This indicates that a StateForm is not being used. In that case, Expresso will call the perform() method on your state passing it the ControllerForm defined in your struts config (make sure your controller form implements StateForm).
If you would like to have more independence between states then you could define a class (does NOT need to extend ActionForm) that holds the data that applies to an individual state and specify this class in the 3rd parameter above. In that case, Expresso would pass an instance of this class to your perform() method and your state logic would be unaware of the Controller within which it is currently running.
Aime
roberto
---
Aime
_____________________________________________________________
Get 25MB, POP3, Spam Filtering with LYCOS MAIL PLUS for $19.95/year.
http://login.mail.lycos.com/brandPage.shtml?pageId=plus&ref=lmtplus
More information about the Opensource
mailing list