gpt4 book ai didi

jsf-2 - Primefaces commandButton 在输入时提交

转载 作者:行者123 更新时间:2023-12-05 00:04:43 25 4
gpt4 key购买 nike

我有两个命令按钮,当我点击输入时,第一个提交。如果用户点击回车,我真的只想提交第二个按钮。有任何想法吗?

最佳答案

我意识到这个问题很老,但也许有人看到不同的解决方案仍然很有趣。

您可以使用 Primefaces defaultCommand 并向您喜欢的 Button 添加一个 id 来定义按下 Enter 键时会发生什么。就这样。

<p:commandButton value="button1" action="#{bean.action1}"/>
<p:commandButton value="button2" id="btn_to_enter" action="#{bean.action2}"/>
<p:defaultCommand target="btn_to_enter" />

关于jsf-2 - Primefaces commandButton 在输入时提交,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5441468/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com