在JSF中执行两种方法 [英] Execute two methods in action in JSF

查看:137
本文介绍了在JSF中执行两种方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在<h:commandButton>的动作中执行两个方法?

Is it possible to execute two methods in action of <h:commandButton>?

例如,

<h:commandButton action="#{bean.methodOne();bean.methodTwo();}" />

推荐答案

您可以像这样使用f:actionListener.

  <h:commandButton action="#{bean.methodOne();}">
    <f:actionListener binding="#{bean.methodTwo();}" />
  </h:commandButton>

您可以根据需要添加任意多个f:actionListener元素.

You can add as many f:actionListener elements as you need.

这篇关于在JSF中执行两种方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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