Anand
Anand

Reputation: 21310

automatic refresh of GWT screen

I am working in GWT in the project. I have a requirement in my project where I need an automatic refresh of my screen every 5 minutes.

Can somebody please help me?

Upvotes: 0

Views: 2954

Answers (3)

Blessed Geek
Blessed Geek

Reputation: 21614

Refresh every 300 seconds (5 minutes):

<meta http-equiv="refresh" content="300">

Place this meta tag under the head element of your gwt html hosting page.

If you use a JSP rather than a HTML file as the GWT hosting file, you could do this

<%
   String refreshInterval = request.getParameter("refreshInterval");
%>
<head>
  <meta http-equiv="refresh" content="<%=refreshInterval%>">
</head>

Upvotes: 0

elkaonline
elkaonline

Reputation: 187

If you use the Activies and Places framework from GWT, you could use the activity-mapper with the 'goTo(samePlace)' method to handle your usecase easily. It's part of the MVP design/pattern.

Upvotes: 1

Shivan Dragon
Shivan Dragon

Reputation: 15219

public class TimerExample implements EntryPoint, ClickListener {

  public void onModuleLoad() {
    Button b = new Button("Click and wait 5 minutes");
    b.addClickListener(this);

    RootPanel.get().add(b);
  }

  public void onClick(Widget sender) {
    Timer t = new Timer() {
      public void run() {
        reloadAll();
      }
    };

    // Schedule the timer to run once in 5 minutes.
    t.schedule(5*1000*60);
  }

  private void reloadAll() {
    Window.Location.reload();
  }
}

Upvotes: 3

Related Questions