Friday, November 20, 2009

GWT : static ressources and public directory


I've just began GWT's learning and I met a problem with static resources.Where can I put my image, css or js file.On the web, I found that you have to put it on public directory.But where create this public directory ?


You have to create a public directory at the same level of the *.gwt.xml file.In my example, it's in src/com/google/gwt/sample/stockwatcher(see image below).
Then when you will run run the app, files will be copy in the war directory automatically.
The last thing you have to do is to put the path of the resources in the html file similar to that :

"<"link type="text/css" href="stockwatcher/css/start/jquery-ui-1.7.2.custom.css rel="Stylesheet"">"
"<"script type="text/javascript" language="javascript" src="stockwatcher/js/jquery-1.3.2.min.js""/" "<"script type="text/javascript" language="javascript" src="stockwatcher/js/jquery-ui-1.7.2.custom.min.js""/>"

Here is a real example (click on the picture to enlarge) :

No comments:

Post a Comment