jsf中取消按钮调用setter getter方法
我有一个屏幕,有 2 个按钮 - 接受和取消,用户可以在其中接受值或取消值。
<div align="center">
<p:commandButton id="cmdAccept" value="#{label.accept}" action="acceptChange"
update="certHolderInfo" disabled="#{certHolderDetail.readOnlyHolderInfo}" />
<p:spacer width="10" height="5" />
<p:commandButton id="cmdCancel" value="#{label.cancel}" action="cancel" />
<p:spacer width="10" height="5" />
</div>
<p:hotkey bind="Alt+A" action="acceptChange" />
<p:hotkey bind="Alt+C" action="cancel" />
当点击取消按钮时,它会调用 setter-getter 方法并更新 bean 的值。而且,当我单击“取消”按钮时,我只是返回到上一个屏幕(视图),如下所示:
<transition on="cancel" to="CMSCertificateHolderInfo" />
理想的条件是,单击“取消”按钮时,它不应该调用 bean 的 setter-getter 方法。我怎样才能实现这个目标?
I have a screen and there are 2 buttons-Accept and Cancel where user can Acept the value or cancel the value.
<div align="center">
<p:commandButton id="cmdAccept" value="#{label.accept}" action="acceptChange"
update="certHolderInfo" disabled="#{certHolderDetail.readOnlyHolderInfo}" />
<p:spacer width="10" height="5" />
<p:commandButton id="cmdCancel" value="#{label.cancel}" action="cancel" />
<p:spacer width="10" height="5" />
</div>
<p:hotkey bind="Alt+A" action="acceptChange" />
<p:hotkey bind="Alt+C" action="cancel" />
When clicking on cancel button it's calling the setter-getter method and update the value of bean. And also when I click on cancel button I am simply going back to previous screen(view) like:
<transition on="cancel" to="CMSCertificateHolderInfo" />
Ideal condition is that on clicking the cancel button it should not call the setter-getter method of bean. How can I achieve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用
process
属性来指定需要处理哪些组件/部件。如果您只想处理按钮的操作,请使用process="@this"
。Use the
process
attribute to specify what components/parts needs to be processed. If you want to process only the button's action, useprocess="@this"
.