Redirecting a page to another page

Hy everyone,

I use Vaadin Framework UI. How can i redirect a page to another page?

Thanks for help

Depends on what scenario do you have. You can do it in a ServletFilter with HttpServletResponse.sendRedirect.
Maybe you want to do it from a UI action in Vaadin app - that would be Page.getCurrent().setLocation(uri).
If you mean navigating to a different view and not a whole http get request, you can use Navigator.navigateTo(urifragment).

iam so sorry , can you explain it in detail, because I am just learning programming, iam so confuse now…
iam newbie in programming with vaadin…

Hi. What kind of use case do you have?

i have the same case… i want to move from page 1 to another page…

but, me use button…

And you are using Vaadin 8 withou CDI or Spring? If that is the case. First you have to setup Navigator as described in

Then you can get Navigator from your UI and navigate to views you have to it.

Button button = new Button("Page 1", event -> UI.getCurrent().getNavigator().navigateTo("page1"));

i try with Button.ClickListener{…}, but the ClickListener is can not be read,… or it Error.

can you help me to find the solution…

Can you paste some code, which is causing you problem?

public class SaveCategory extends VerticalLayout implements HasUrlParameter<Long> {
    private final CategoryEditor editor;
    private final CategoryRepository repository;

     class ButtonListener implements Button.**ClickListener**{
        String menuitem;

        public ButtonListener(String menuitem) {
            this.menuitem = menuitem;

    public SaveCategory(CategoryEditor editor, CategoryRepository repository){
        this.editor = editor;
        this.repository = repository;

        HorizontalLayout resek = new HorizontalLayout();
        add(resek, this.editor);
        editor.editCategory(new Category(""));

    public void setParameter(BeforeEvent beforeEvent, @OptionalParameter Long aLong) {
        boolean editView = beforeEvent.getLocation().getPath().contains(Const.PAGE_CA_EDIT);
        if (aLong != null) {

but Button.ClickListener{…} cannot be resolve…

Apparently you are not using Vaadin 8, which I assumed when pasting my solution. Vaadin 10+ version is:

Button button = new Button("Page 1", event -> UI.getCurrent().navigate("page1"));

And if you don’t want to use lambdas and want to create a class for the listener, it’s:

import com.vaadin.flow.component.ClickEvent;
import com.vaadin.flow.component.ComponentEventListener;

class ButtonListener implements ComponentEventListener<ClickEvent<Button>> {
	public void onComponentEvent(ClickEvent<Button> event) {