简体   繁体   English

单击按钮以重定向到Vaadin中的表单

[英]button click to redirect to a form in Vaadin

I am trying to write code that displays a button that when clicked will redirect me to a form in Vaadin. 我正在尝试编写显示一个按钮的代码,当单击该按钮时,会将我重定向到Vaadin中的表单。 Can you help with this? 你能帮忙吗? Here is my form1 code. 这是我的form1代码。 My goal is that when subscribeBtn is pressed I will be redirected to form2. 我的目标是当按下subscribeBtn时,我将被重定向到form2。

 public class AchrefliferayApplication extends Application {

    @Autowired
    ArticleService articleService;


    public void init() {
        Article article;

        Window w = new Window("Subscribe Newsletter");
        setMainWindow(w);
        w.setContent(new VerticalLayout());

        Button subscribeBtn = new Button("saisi");

        w.addComponent(subscribeBtn);


    }

}

Add a ClickListener to the button. 将ClickListener添加到按钮。 In the handler, create a new Window that holds the Form2 object (setContent), and use setModal on the Window. 在处理程序中,创建一个保存Form2对象(setContent)的新Window,并在Window上使用setModal。

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

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