Where do I put static files for GWT app? war folder or public folder?

前端 未结 3 1960
攒了一身酷
攒了一身酷 2020-12-05 19:35

I have some JavaScript files, a main HTML file, a main CSS file, and some CSS files that get imported into the main one.

I understand that I can put static files in

3条回答
  •  难免孤独
    2020-12-05 20:06

    The difference between the 2 locations is that files in the public folders are copied by the gwt compiler to the 'your module' folder in the 'war' folder. This is means if you deploy the 'war' (for example via the google plugin to the google appengine) the files from the 'public' folder are not at the toplevel.

    For example, if you have an index.html in the 'public' folder with gwt module named 'mymodule' and you deploy it to www.example.com it looks as follows, you need to access it via:

    www.example.com/mymodule/index.html
    

    If you have the index.html in the 'war' folder, you get:

    www.example.com/index.html
    

    Summarizing. Your landing page should be in the 'war' folder. Resource files used by the landing page can also be stored here (css, images). Any other resource file that is referred to in any gwt module file (or code, like images) should be stored in the 'public' folder related to the gwt module.

提交回复
热议问题