简体   繁体   中英

Where to store external images Intellij GWT Projects

I'm using Intellij and GWT, I created a GWT project and Intellij has automatically created the directory structure. I have then tried to add an external image, however I am getting a 404 when trying to retrieve the image.

Project structure is below:

project
-- .idea
-- out
-- src
---- com.project
-------- client
-------- server
-------- project.gwt.xml
-- web
---- images
-------- myimage.png
---- WEB-INF
---- project.css
---- project.html

I am setting the image URL with:

img.setUrl(GWT.getModuleBaseURL() + "images/myimage.png");

I have read a few similar issues saying it need to be placed within an images folder within the war folder, however with intellij it has not generated a war folder, just the web folder, so I am thinking my issue may be around this.

I had no problems doing the same thing when using GWT with Eclipse however I now have to use Intellij.

You need to use:

img.setUrl("images/myimage.png");

web folder is not related to GWT modules - it's the same for the entire app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM