Re: [Actionframework-users] parameters to output-variable methods
Status: Inactive
Brought to you by:
ptoman
From: Petr T. <Pet...@pi...> - 2002-08-07 19:43:25
|
> is there any way to pass parameters to the methods that > output-variable defined values call? for eg: > > <output-variable name="objectList" component="objectHandler" > value="getObjectList(Context context)"/> Sure! You can use $variables in method calls in <in/output-variable>s: <output-variable name="objectList" component="objectHandler" value="getObjectList($context)"/> ....supposing that $context is already in the context. > if not, then i really think there should be. seems to me that the > Context is (almost) indispensable for most of these calls. now, i > suppose one could work around this a bit by making sure the component > is marked as 'session', then use the component itself that to hold > all of the other data pieces one might need for a request. but by > not having any defined interfaces between the main servlet > (ActionServlet) and the component, there is no way to easily setup > any 'session' data by passing it to the constructor or some other > init() method. so, this means that any shared data would need to > come from some static or singleton mechanism, which limits its > flexibility. make sense? Components created by DefaultInstantiator can have constructor with a parameter ActionServlet (or its subclass), so you can pass the servlet reference to the component. Petr -- [ http://dione.zcu.cz/~toman40 - Pet...@pi... - ICQ=22957959 ] |