如何将参数(从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
中接收这组参数以将其发送到备用bean?
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屋!