Events 将侦听器添加到页面刷新事件
我有一个需要在页面刷新后执行的操作 (不一定要按F5键,但在刷新页面时可随时按) 如何添加此类事件侦听器?我使用以下方法:Events 将侦听器添加到页面刷新事件,events,primefaces,Events,Primefaces,我有一个需要在页面刷新后执行的操作 (不一定要按F5键,但在刷新页面时可随时按) 如何添加此类事件侦听器?我使用以下方法: <h:form> <p:remoteCommand name="update_page" process="@this" update="form" actionListener="#{myView.myAction}" /> . . . . </h:form> <script> $(document).ready(
<h:form>
<p:remoteCommand name="update_page" process="@this" update="form" actionListener="#{myView.myAction}" />
.
.
.
.
</h:form>
<script>
$(document).ready(function() {
update_page();
}
</script>
.
.
.
.
$(文档).ready(函数(){
更新页面();
}
加载或刷新页面运行RemoteCommand。我使用以下命令:
<h:form>
<p:remoteCommand name="update_page" process="@this" update="form" actionListener="#{myView.myAction}" />
.
.
.
.
</h:form>
<script>
$(document).ready(function() {
update_page();
}
</script>
.
.
.
.
$(文档).ready(函数(){
更新页面();
}
加载或刷新页面运行RemoteCommand。为什么不在
p:RemoteCommand
中添加一个autorun=“true”
?工作原理相同,代码更少是的,这是真的。我使用将对RemoteCommand的调用嵌入到$(文档)中。ready()来管理模式启动屏幕为什么不添加一个autorun=“true”
到p:remoteCommand
?工作原理相同,代码更少是的,没错。我使用将对remoteCommand的调用嵌入$(document).ready()来管理模式启动屏幕