Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以将弹出提示中的值传递给 CDI 托管 bean,如下所示:
h:commandButton image="/resources/images/editButton.png" onclick='mytext = prompt("Enter text: ")' action='#{myBean.foo(mytext)}'
提示打开,调用了 foo 方法,但是如何传递 mytext 值?
您需要创建一个隐藏输入,更改您的 JS 以在隐藏字段上设置该输入的值并将其发送到服务器。