JSF2动作参数 [英] JSF2 Action parameter

查看:120
本文介绍了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆