简体   繁体   English

单击该页面上的按钮后,如何让JSF跳过getter方法调用?

[英]How to let JSF skip getter method call after clicking of button on that page?

Actualy I want after clicking logout session get invalidate. 实际上,我想在单击注销会话后变得无效。 But it is going firstly on getter setter and there I created a session. 但这首先是在getter setter上进行的,在那里我创建了一个会话。 After that is goes to session invalidate method. 之后进入会话无效方法。 And it will throw exception. 它将引发异常。

How would I skip getter setter on click of button and directly call the action method? 我如何在单击按钮时跳过getter setter并直接调用action方法?

Just don't do business job in getters/setters. 只是不要在吸气机/吸气机中做生意。 The getters/setters should solely do the things as their name suggests: returning a property or setting a property. 获取者/设置者仅应按照其名称所示执行操作:返回属性或设置属性。 Nothing more. 而已。 It should not load/preinitialize properties. 它不应加载/预初始化属性。 The loading/preinitializing should be done by a (post)constructor or action(listener) method. 加载/预初始化应通过(后)构造函数或action(侦听器)方法完成。

See also: 也可以看看:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM