读书人

Action逻辑分离及顺序有关问题

发布时间: 2012-10-24 14:15:58 作者: rapoo

Action逻辑分离及顺序问题

value="submit" styleClass="button">
?<f:actionListener binding="#{entitySupport.flush()}"/>
<f:actionListener binding="#{xxxx}"/>
</a4j:commandLink>
Jsf规范规定了动作组件(比如h:..command..,a4j:..command..)上各种动作的顺序按下面顺序执行
1)按页面顺序<f:actionListener
2)actionListener属性(规范已经不建议使用了,a4j:commandLink运行时将之变成第一个<f:actionListener,相当于在最前面增加个<f:actionListener)
3)action属性,最后执行,主要功能是负责导航,建议不在里面做业务操作,下面的示例导致entitySupport.flush()在refBspgenparAction.save前面执行。
<a4j:commandLink action="#{refBspgenparAction.save}">
?<f:actionListener binding="#{entitySupport.flush()}"/>

建议:所有按钮都使用a4j:..command.的,并将最先需要执行的方法放入actionListener属性中。

?

读书人网 >软件架构设计

热点推荐