java 如何使用刷新按钮刷新 vaadin 页面

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39444823/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 04:23:24  来源:igfitidea点击:

How to refresh a vaadin page with the refresh button

javavaadinvaadin7

提问by dhS

I need to refresh the page in vaadin. I created a Refresh Button but the button is not working for refreshing the page.

我需要在 vaadin 中刷新页面。我创建了一个刷新按钮,但该按钮无法刷新页面。

Button Refresh = new Button("Refresh");
Refresh.addClickListener(new Button.ClickListener() {
    @Override
    public void buttonClick(Button.ClickEvent clickEvent) {
    }
});

回答by Axel Meier

Call this in your Button ClickListener:

在您的 Button ClickListener 中调用它:

Page.getCurrent().reload();

This reloads the page in the browser.

这会在浏览器中重新加载页面。

回答by AndyW

For Vaadin 10:

对于 Vaadin 10:

Call this in your Button ClickListener:

在您的 Button ClickListener 中调用它:

    UI.getCurrent().getPage().reload();