【问题标题】:How to periodically refresh a view in vaadin?如何定期刷新vaadin中的视图?
【发布时间】:2014-08-11 07:35:53
【问题描述】:

我想定期刷新页面的某个部分。因此,我创建了一个 @Scheduled 方法,将更改的值相应地应用于小部件。

但该方法永远不会执行:

@Controller
@UIScope
public class MyViewPresenter {
    private View view;

    @Scheduled(fixedRate = 1000)
    public void refresh() {
        System.out.println("this is never executed. why?");
            //view.change...
    }
}

当我将此方法移动到我的@Configuration 类中时,sysout 打印得很好。所以总的来说,我可以假设调度按预期工作。但不是在我的演讲课上。为什么?

【问题讨论】:

标签: java spring vaadin


【解决方案1】:

您需要开启服务器推送功能11.16. Server Push

简而言之:

  • vaadin-push 库添加到您的依赖项中
  • 启用推送(@Push注解或servlet配置)
  • 使用UI.access(..)进行推送

【讨论】:

  • 你可以更具体一点
猜你喜欢
  • 1970-01-01
  • 2018-04-11
  • 2012-10-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多