11

I have searched for a long time, but I really cannot figure this out.

How do I redirect the user to a new external link (e.g. www.google.com) when they click a button in Vaadin?

The only thing I have managed to do so far is to put the link into a link

Link link = new Link("link", new ExternalResource("http://www.google.com"));

Can anyone help me out with this please?

Krayo
  • 2,492
  • 4
  • 27
  • 45
user3702643
  • 1,465
  • 5
  • 21
  • 48

1 Answers1

28
getUI().getPage().setLocation("http://www.google.com");

References: Page (Vaadin 7.2.1 API) and Vaadin application lifecycle (Book of Vaadin).

VH-NZZ
  • 5,248
  • 4
  • 31
  • 47
  • Hi thanks for the help! Is it possible for you to tell me how to open the page in a new tab? Thanks again! – user3702643 Jun 04 '14 at 12:12
  • @user3702643 No worries. I think that you may want to start with a fresh question with that. Post back here and I'll answer it. – VH-NZZ Jun 04 '14 at 13:56
  • @user3702643 Please post the new question link – Bhuvan Jul 14 '14 at 13:14
  • @user2410148 http://stackoverflow.com/questions/24039476/vaadin-open-link-in-new-tab/24039630#24039630 – VH-NZZ Jul 14 '14 at 13:32
  • I am also facing the redirect issue. If i use this way as you mentioned above. the page is redirecting into internal page not the main page. Could you please help me? – Azhaguvel A Nov 13 '14 at 13:33
  • This doesn't seem to work on the latest (.18) version. Does somebody know how is it achieved in more recents versions? – tony _008 Dec 03 '20 at 11:27