0

I am building a project in GWT and the project requires navigation from one page to another when a button is clicked. How do I do this? Or should I simply write the entire code in the same class file? I know there has to be a way of navigation.

How should I achieve page navigation in GWT?

RAS
  • 8,100
  • 16
  • 64
  • 86
richim
  • 21
  • 1
  • 4

2 Answers2

2

You should look at GWT Platform

With this library, you can define places. When the user clicks on a button, you just reveal a new place.

In addition, this framework allows you to handle the lifecycle of your GWT components and do some code splitting : page 1 and page 2 can be compiled in 2 different js so that you only load the one you need.

it is also a (and mainly) a MVP framework, like gwt-presenter.

Arnaud Denoyelle
  • 29,980
  • 16
  • 92
  • 148
1

You can do Page navigation through History mechanism of GWT. Here are the steps you should follow:

  1. Add a history string to an iframe of your host page:

  2. Register a ValueChangeHandler that will receive an event of history (page) change. Within this handler you need put a logic that displays the new page. For example, History.addValueChangeHandler(object of subclass of HistoryHandler);

  3. After doing this whenever you need to navigate to another page do the following: History.newItem("history string of your page to be displayed");

RAS
  • 8,100
  • 16
  • 64
  • 86
  • 1
    Please click on the text in blue which says "History" in RAS's reply. It is a hyperlink and will provide you all the details you require – maneesh Jul 08 '13 at 10:57
  • @maneesh thanks for saying this. My answer to the richim's comment is the same. – RAS Jul 09 '13 at 06:23
  • @richim, Please go through the link & then tell me what you didn't understand? – RAS Jul 09 '13 at 06:23