您如何将参数(来自 javascript)传递到 remoteCommand(& 然后将其发送到支持 bean)? [英] How do you pass parameters(from javascript) into remoteCommand(& then send it to backing beans)?
问题描述
要将参数从 JS 传递到 p:remoteCommand
(由 primefaces 提供),您可以使用:
For passing paramters from JS to p:remoteCommand
(provided by primefaces), you can use this:
remoteCommandFunctionName({name1:'value1', name2:'value2'});
之后,你如何在remoteCommand
中接收这组参数以将其发送给backing beans?
After that, how do you receive this set of parameters in remoteCommand
for sending it to backing beans?
推荐答案
无耻地插入我的答案,因为在 PrimeFace 3.3 中解决这个问题要花费我几个小时.解决方案是将您的参数作为 {name: <param-name>, value: <param-value>} 的数组传递.
Shamelessly plug my answer because it costs me hours to solve this problem in PrimeFace 3.3. The solution is to pass your arguments as an array of {name: <param-name>, value: <param-value>}.
在 Neyko 的回答中,调用应改为:
As in Neyko's answer, the invocation should be changed to:
remoteCommandFunctionName([{name: 'name1', value: 'value1'}, {name: 'name2', value: 'value2'}]);
这篇关于您如何将参数(来自 javascript)传递到 remoteCommand(& 然后将其发送到支持 bean)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!