set the header of the window for a new page

Hi,

When I am opening a new page with a url, how do I set the header of the window?

I am trying to do something like this -

Window window = new Window();
URL url = window.getURL();
getWIndow().open(new External Resource(url))

When I try to do something like this, I can’t seem to set the title of the window with just setCaption.

Is there something else I can try? Thanks

Crystal

shot in the dark: did you try caption?

I did try setCaption already.
But the caption doesn’t show after I do the :

getWindow().open( new External Resource (url))

If I don’t have that statement and just do getWindow().addWindow(…), then the caption will show.

Help please?

The constructor for Window takes a String caption which will be the window’s title. Alternatively, you can call setCaption() too.

Yes I know, but as I’ve mentionned before

Window window = new Window(“test”);
URL url = window.getURL();
getWIndow().open(new External Resource(url))

After I do an open to the url, the window that I get back doesn’t have the title of “test”.

I trust the typos are not really there in your code since it wouldn’t compile.

It might help if you showed the actual code used.

If the new window is to appear as a vaadin window (not a browser window), you should be sure to add the window to your main window: vaadinApp.getMainWindow().addWindow(window). This doesn’t use an URL, though.

For a new browser window, you’d the the same, but add the window to the app directly: vaadinApp.addWindow(window); followed by vaadinApp.getMainWindow().open(new ExternalResource(url),“_blank”);

We found that we could make a ‘proxy’ html page that will update the title and then forward the request on as a POST instead of a get so the user doesn’t see all the parameters in the URL. See:

http://stackoverflow.com/questions/133925/javascript-post-request-like-a-form-submit
http://stackoverflow.com/questions/118693/how-do-you-dynamically-create-a-radio-button-in-javascript-that-works-in-all-brow#120372

Best,

Mark