我有以下代码:
<h:commandLink action="#{testBean.showSomething}">
Do Stuff
</h:commandLink>
Run Code Online (Sandbox Code Playgroud)
做我想要的(改变testbean的状态并重新加载将显示不同的div组的页面.因为它们的"渲染"属性)现在我想用ajax来完成这个,所以我做了这个:
<h:commandLink action="#{testBean.showSomething}">
<f:ajax event="click" render=":content" />
Do Stuff
</h:commandLink>
Run Code Online (Sandbox Code Playgroud)
但是这会导致showSomething方法甚至不被调用.恕我直言,我想做的事情相当简单,但我不能为我的生活弄清楚如何去做.
Bal*_*usC 18
你需要使用event="action"而不是event="click".你甚至可以完全省略它.它<f:ajax>是嵌套在UICommand组件中时正在侦听的默认事件.
<h:commandLink action="#{testBean.showSomething}">
<f:ajax render=":content" />
Do Stuff
</h:commandLink>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
22877 次 |
| 最近记录: |