[NOOB] import necessary for Page.getCurrent()

hello, I would like to know what’s the import necessary for Page.getCurrent(), a google search leads me to com.vaadin.server package, but eclipse notifies me that import com.vaadin.server cannot be resolved, also tried com.vaadin.server.* but was unable to resolve it.

he is the class I’m trying to run


package com.example.juju;

import com.vaadin.Application;
import com.vaadin.ui.Label;
import com.vaadin.ui.Window;
import com.vaadin.ui.Window.Notification;

public class JujuApplication extends Application
{
   @Override 
   public void init() {
      Window mainWindow = 
         new Window("Myproject");
      
   // Notification with default settings for a warning
      Notification notif = new Notification(
          "Warning",
          "<br/>Area of reindeer husbandry",
          Notification.TYPE_WARNING_MESSAGE);

      // Customize it
      notif.setDelayMsec(20000);
      notif.setPosition(Notification.POSITION_BOTTOM_RIGHT);
      notif.setStyleName("mystyle");
      
                      
      // Show it in the page
      [b]
notif.show(Page.getCurrent());
[/b]
      
      setMainWindow(mainWindow);
 }
}

how can I get that Page.getCurrent() in bold to run?

thanks in advance

yo have to give the complete url, like so:

import com.vaadin.server.Page;

if eclipse doesnt find that, you have a classpath issue…

I apologize, forgot to mention that I tried import com.vaadin.server.Page; as well and added ?restartApplication in the url too .
could you please help me solve the classpath problem, I have followed the steps in “the book of vaadin” and “learning vaadin” step by step and reinstalled eclipse and the vaadin plug-ins several times both via
https://vaadin.com/eclipse/
and the eclipse add-on
https://vaadin.com/directory#addon/vaadin-plug-in-for-eclipse
(but not both at the same time obv)

side question, are com.vaadin.server.Page; and Page.getCurrent() supported in vaadin 6.x ?

thanks in advance

Nope, com.vaadin.server.Page is from Vaadin 7.

use mainWindow,showNotification(notif); after the mainWindow is added.
But you will only see that once, for it is in the apps init in your code which is only called once per session.

thank you, that resolved my issue, I was trying com.vaadin.server.Page in my system that has vaadin 6.8 which doesn’t support.