JSF2 动作参数 [英] JSF2 Action parameter
本文介绍了JSF2 动作参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经阅读了有关通过 actionListener 将参数从 jsf 页面传递到 managedbean 的信息.是否也可以将参数传递给简单的操作方法?
I have read about passing parameters from jsf page to managedbean through actionListener. Is it also possible to pass a parameter to a simple action method?
感谢阅读...
谢谢两位的建议!没有你我会迷失的:-)
Thank you both for your advices! I would be lost without you :-)
以下对我有用:
<h:commandLink id="link" action="#{overviewController.showDetails}" >
<f:setPropertyActionListener target="#{overviewController.show_id}" value="#{project.id}" />
<h:outputText value="#{project.title}" />
</h:commandLink>
那么现在谁应该得到绿色勾号?:-P 我可以给两个吗?
So now who deserves the green tick? :-P can I give two of them?
推荐答案
是的.要么:
action="#{bean.method(param)}"
或
<h:commandButton .. >
<f:setPropertyActionListener
target="#{bean.targetProperty}" value="#{param}" />
</h:commandbutton>
(并在方法中使用 bean 属性)
(and use the bean property in the method)
这篇关于JSF2 动作参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文