setTheme() different behaviour with Firefox 4.0.1


I was playing around with themes and I put a NativeSelect on my page to switch between different themes. This worked fine in Firefox 4.0.1 but all other browser didn’t switch the theme. I found that Application.init() is called right after I’ve changed the theme via the NativeSelect callback. In Application.init() I set the default theme. Unfortunately, this call to init() doesn’t happen in Firefox 4.0.1! With Firefox the Application.init() method is ONLY called when the app is starting.

Is there a best practise to change themes by the user?

Thanks in advance


You can look at the source code of the Sampler application, there’s a theme switcher select that changes the theme on the fly:

Hi Jouni,

thanks for your reply. I will have a look into the sampler app.

Nevertheless, I still ask myself why my app behaves different with Firefox than with all other browsers?



Application.init() is automatically called when you call Application.setTheme(String)? That sounds weird to me. If that is really true, I reckon it is a bug, except if there are some special specs that I haven’t heard of. Can you create a minimal test case where you can demostrate this odd behviour and file it at

Hi Jens,

I made a little test app to isolate the problem and with this test app the init method isn’t called anymore when setTheme() changes the theme. Now I have to find the difference between the test app and the other app.

Thanks for your advice


The method init() is not supposed to be called once the application has been started and the window displayed - it is only for application startup.

If it is called, the application is restarting itself at that point instead of just changing the theme.

Any results/updates on this? I have the same issue here. I am trying to call setTheme().
With Google Chromium 17 init() is called.Firefox 11 works just fine.
I am on Vaadin 6.7.5


Same issue with Google Chrome 19 and Vaadin 6.7.9.
Once I call setTheme (the Application is already created, thus there is an existing jsessionid for the given user), the Application.init method is called one more time (as part of the process of creating a new Application) and a new jsessionid is returned from the server. It is working fine with Firefox 12.
Any update on this?

I found that it makes a difference if the URL ends with ‘/’ or not,
so http://server:port/app had a different behavior than http://server:port/app/


Perhaps somehow related to this if you use Tomcat?

Yep. Same thing.

Yes, you are right. Using ‘/’ makes a difference!