Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 2 在用户按住按钮的同时连续多次提交表单_Jsf 2_Form Submit - Fatal编程技术网

Jsf 2 在用户按住按钮的同时连续多次提交表单

Jsf 2 在用户按住按钮的同时连续多次提交表单,jsf-2,form-submit,Jsf 2,Form Submit,当用户按住按钮时,如何实现多表单提交 <h:commandButton value="Multiple submission" action="#{mngr.doSomething}"/> 基本上,只要按住按钮,我就想继续调用mngr.doSomething方法。有什么想法吗?您可以使用javascriptsetInterval()函数添加javascript事件监听器,以便在所需的时间间隔内提交表单(使用AJAX)。您可以使用javascriptsetInterval()函数

当用户按住按钮时,如何实现多表单提交

<h:commandButton value="Multiple submission" action="#{mngr.doSomething}"/>


基本上,只要按住按钮,我就想继续调用mngr.doSomething方法。有什么想法吗?

您可以使用javascript
setInterval()
函数添加javascript事件监听器,以便在所需的时间间隔内提交表单(使用AJAX)。

您可以使用javascript
setInterval()
函数添加javascript事件监听器以提交表单(使用AJAX)在你想要的时间间隔内。

只有当你使用
而不是渲染按钮本身时,这才是可能的。然后,通过显式调用按钮的
onclick()
处理程序,您可以使用
onmousedown
onmouseup
事件启动和停止rage submit,并且可以使用
继续显式调用
onclick()
handler在成功返回时,只要按钮看起来仍然按下

以下是一个启动示例:

<h:form>
    <h:commandButton value="submit" action="#{bean.submit}" onmousedown="startRageSubmit(this)" onmouseup="stopRageSubmit(this)">
        <f:ajax onevent="processRageSubmit" />
    </h:commandButton>
</h:form>

这只有在使用
时才有可能,而不是渲染按钮本身。然后,通过显式调用按钮的
onclick()
处理程序,您可以使用
onmousedown
onmouseup
事件启动和停止rage submit,并且可以使用
继续显式调用
onclick()
handler在成功返回时,只要按钮看起来仍然按下

以下是一个启动示例:

<h:form>
    <h:commandButton value="submit" action="#{bean.submit}" onmousedown="startRageSubmit(this)" onmouseup="stopRageSubmit(this)">
        <f:ajax onevent="processRageSubmit" />
    </h:commandButton>
</h:form>