Hi,
Most of the Action classes we are developing get or set an object from/to one of the two scopes, request or flow. Also, we like to be able to configure the name of the attribute and which scope to use, much like the FormAction.
First we were going to move this common code to a parent Action class which inherited from AbstractAction, but as we also have MultiActions, we created a separated helper class. Then, we define our actions like this:
And then, from my action class, I can get or set the object from the scope like this:Code:<bean id="MyAction" class="com.disid.MyAction"> <property name="attributeName"> <value>MyObject</value> </property> <property name="objectScopeAsString"> <value>flow</value> </property> </bean>
Maybe this functionality could be moved to the AbstractAction class, as I think it is going to be very common in general. What do you think?Code:Object object = getScopeHelper().getScopeObject(context); getScopeHelper().storeScopeObject(element, context);
Cèsar


Reply With Quote