|
|
Accessing a flow-scope bean from bean-action
Hi all,
I have defined a flow-scope bean in my flow as:
lt;var name=quot;bean1quot; bean=quot;bean1quot; scope=quot;flowquot;/gt;
I would like to invoke the setTotal() method in the above flow-scoped bean in an action-state as :
lt;action-state id=quot;startquot;gt; lt;bean-action bean=quot;bean1quot; method=quot;setTotalquot;gt; lt;method-argumentsgt; lt;argument expression=quot;2quot;/gt; lt;/method-argumentsgt; lt;/bean-actiongt; lt;transition on=quot;*quot; to=quot;nextquot; /gt;
lt;/action-stategt;
However, my flow-scoped bean (bean1) does not seem to be affected in the above action-state. Am I missing something ?
Thanks,
Sriram
Hello
basicaly in this case you have two instance of your bean. One is resolved for setting the variable, the other instance is resolved for the bean action (this is done only once in the startup).
In your case, you will need an evaluation action, which calls your method on the flowscope variable. Have a look at the numberguess example, there you can find your use-case.
Hope this helps you out
best rgds
agim
Thanks Agim! |
|