Apache flex Flex:RemoteObject,传递命名参数
我使用Flex的RemoteObject方法调用ColdFusion cfc方法Apache flex Flex:RemoteObject,传递命名参数,apache-flex,coldfusion,flex4,Apache Flex,Coldfusion,Flex4,我使用Flex的RemoteObject方法调用ColdFusion cfc方法 <fx:Declarations> <s:RemoteObject destination="ColdFusion" source="cfc.categoryGateway" id="categoryGateway"> <s:method name="getCategoryList" result="returnHandler(event)"
<fx:Declarations>
<s:RemoteObject destination="ColdFusion" source="cfc.categoryGateway" id="categoryGateway">
<s:method name="getCategoryList" result="returnHandler(event)"
fault="mx.controls.Alert.show(event.fault.faultString)">
<s:arguments>
<orderby>categoryId</orderby>
<parentCategory>1</parentCategory>
</s:arguments>
</s:method>
</s:RemoteObject>
</fx:Declarations>
类别
1.
其中,我的cfc以以下方式接受参数:
<cffunction name="getCategoryList" access="remote" output="false" returntype="query">
<cfargument name="parentCategory" type="string" required="false" />
<cfargument name="orderby" type="string" required="false" />
<!--- code... --->
<cfreturn qCategoryList />
</cffunction>
所以你可以看到,当我调用cfc方法时,我改变了参数的顺序。但它不起作用
这意味着
不传递名为的参数。
有什么解决办法吗?正如您所看到的,我可能有一些参数不是强制性的,因此,它必须按名称传递。参数是一个数组,因此无论您如何命名每个元素,我认为它仍将按顺序使用它。 您可以尝试这样做:
<s:RemoteObject destination="ColdFusion" source="cfc.categoryGateway" id="categoryGateway">
<s:method name="getCategoryList" result="returnHandler(event)"
fault="mx.controls.Alert.show(event.fault.faultString)" />
</s:RemoteObject>
你确定问题出在flex上吗?您是否尝试过将参数范围转储到文件中,以查看Flex调用cfc方法时文件中的内容?是的,因为当我交换参数时,SQL查询中会出现如下错误:无法调用cfc-CFSQLTYPE CF\ U SQL\ U INTEGER的无效数据类别ID
parentCategory
实际上不是一个字符串参数,而是我在SQL查询中使用的一个整数参数如果参数顺序相同,则其工作正常。
categoryGateway.getCategoryList({orderby:'categoryId', parentCategory:'1'});