tags:

views:

47

answers:

3

Hi..

I have created one gwt application. In the client package i inculded two java file contains gwt coding. In the first java program i included one Hyperlink when this Hyperlink is clicked it should redircted to Second file which also contains some GWT coding. I dont know how to redirect the java file.

Help me on this issue...

Regards, Raji

+1  A: 

You can use a Hyperlink that switches a panel from PageA to PageB. You have to think more like an application developer instead of a web "pages" developer with GWT.

Bakkal
+2  A: 

Bakkal is correct, you want to think about swapping out Widgets instead of navigating to a different web page. Here is some code to illustrate this point:

  /** The main panel associated with your GWT app's content */
  private Panel contentPanel;      

  public void onModuleLoad() {
    PageA pageA = new PageA();

    // When the user clicks 'GotoB' navigate to pageB.
    pageA.onButtonClickedHandler(new ClickHandler() {
      @Override
      public void onClick(ClickEvent event) {

        PageB pageB = new PageB();
        contentPanel.clear();
        contentPanel.add(pageB);
      }
    });

    contentPanel = new VerticalPanel();
    contentPanel.add(pageA);

    RootPanel.get("gwtAppBody").add(contentPanel);
  }
Chris Smith
A: 

Check out the MVP pattern for creating GWT web apps. This is the answer to all your "gwt page switching questions" ;)

The pattern integrate an history managing system with some view while respecting the MVC (Model-View-Controller). They called it MVP (Model-View-Presenter) and gave it their own flavor. Add some UiBinder (new in GWT since 2.0) to create your view and you're in for a good ride! If you don't know what is a design pattern, don't be afraid to ask, people will be happy to answer

Zwik