如何将动态生成的按钮的 ID 传递给操作方法?
我创建了一个 Facelets 页面。在页面中动态生成一些按钮,每个按钮都有一个ID, 提交事件时,我想将按钮的ID传递给操作。(按钮是动态的)
但我不知道如何在JSF中传递动态参数。
I created a Facelets page. In the page dynamically generated some buttons, each button has a ID,
When submitted the event, I want to pass a button's ID to the action.(button is dynamically)
But i don't know how to pass dynamic parameters in JSF.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过
UIComponent#getCurrentComponent()
:或者,如果您的目标是 Servlet 3.0 / EL 2.2 容器(Tomcat 7、Glassfish 3 等),那么您可以在 EL 中调用带参数的方法
:
You can get the button component in the action method by
UIComponent#getCurrentComponent()
:Alternatively, if you're targeting a Servlet 3.0 / EL 2.2 container (Tomcat 7, Glassfish 3, etc), then you can just invoke methods with arguments in EL:
with