Loading dynamic HTML page prior than javascript.

I have a HTML page which i put in the layout folder and a javascript file in themes folder. I link those javascript files in my servlet class (which extends ApplicationServlet). Now the problem is. there is no error in browser console nor in eclipse console and it does not work either. What I feels is that it loads the javascript first and then it loads html so javascript code doesnot find any html tag because HTML is created dynamically afterwards. I am using VAADIN 6.8.9. Any suggestion would be highly appreciated? I am new to VAADIN so kindly if i am wrong in my above servlet concept or layout concept so please do not mind and let me know the correct thing too. Thank You,
15931.java (2.96 KB)