Questions tagged «prerenderview»

2
何时使用f:viewAction / preRenderView与PostConstruct?
什么时候应该使用f:viewAction或preRenderView事件来初始化页面数据而不是使用@PostConstruct注释?是根据后备bean的范围类型使用一个或另一个的理由,例如,如果后备bean是@RequestScoped,那么在呈现视图之前使用f:viewActionor preRenderViewover @PostConstruct初始化后备bean 的选择将是不相关的,因为两者结果相同吗? f:viewAction或preRenderView <f:metadata> <f:viewAction action="#{myBean.initialize}" /> </f:metadata> <f:metadata> <f:event type="preRenderView" listener="#{myBean.initialize}"/> </f:metadata> 要么 @PostConstruct public class MyBean { @PostConstruct public void initialize() { } }
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.