Re: [Actionframework-users] parameters to output-variable methods
Status: Inactive
Brought to you by:
ptoman
From: Craig L. <cr...@be...> - 2002-08-08 19:18:18
|
On Wed, 2002-08-07 at 15:39, Petr Toman wrote: > > is there any way to pass parameters to the methods that > > output-variable defined values call? for eg: > > > > <output-variable name=3D"objectList" component=3D"objectHandler" > > value=3D"getObjectList(Context context)"/> >=20 > Sure! You can use $variables in method calls in <in/output-variable>s: >=20 > <output-variable name=3D"objectList" component=3D"objectHandler" > value=3D"getObjectList($context)"/> >=20 > ....supposing that $context is already in the context. hmm, the fact that this requires the data to be in the context, and won't even try to extract it from the URL is causing me a bit of a problem. what i'm trying to do is have one template that shows a list of objects. if that template is called with nothing, it simply pulls up the 10 most recent objects and shows them. however, if that page is called with an 'objectTypeID' in the URL, i want only the objects that match that type to be displayed. this should all happen on this template, regardless of what the action/form stuff is, preferably this page will be linked directly from outside sources. what i had tried to do is this: i considered using an invoke element (which is allowed inside a template block), but then you seem to have no control over the return value. and besides, the invoke element is clearly aimed at achieving a different end than i'm trying. i think what work best for me in my specific case, is an enhancement to the output-variable element. having the ability to use it very similar to the action.method would be most desirable, and i think the easiest way to do this would be to have a 'method' attribute allowed in it.=20 then, either the value=3D"" or the method=3D"" would be required, the value=3D"" being processed as it does currently (using the template evaluator from the looks of it), and the method=3D"" gets processed exactly the same way that action.method is processed. i suppose this might mean that it might make sense to allow input-variable elements inside the output-variable block, which seems a bit strange. what does everyone think? is this a very specific case, or would action.method like functionality in output-variable be useful anywhere/to anyone else? cheers, --=20 CraigL->Thx(); Be Developer ID: 5852 |