问题
I'd like to take the files and upload them to a publicly hosted site.
This is the document tree I find when I follow the path listed in the Eclipse output:
/home/.../playndev/html/target/playndev-html-0.0.1-SNAPSHOT/playndev
├── clear.cache.gif
├── F23CD74BBFAF29D08D2B82AA57A90407.cache.html
├── gwt-voices.swf
├── hosted.html
├── images
│ └── bg.png
└── playndev.nocache.js
I would expect to be able to move the root playndev
directory to another public server folder and run my script independently, but when I move them for instance to /var/www/playndev
on my machine, neither the F23CD...cache.html
file or hosted.html
loads.
Am I misunderstanding the document layout or something more fundamental?
回答1:
There should not be any problem in changing the location of GWT generated files as long as the Host page has proper location for nocache.js file which you can verify in the script tag of your Host page. Refer to this link for more info
回答2:
GWT only generates a script (set of scripts and resources), you're responsible for providing an HTML host page that loads the generated playndev/playndev.nocache.js
script.
You're supposed to put that HTML page in your project's src/main/webapp
and it will be copied by Maven into the target/playndev-html-0.0.1-SNAPSHOT
folder. You can then copy the whole content of that folder to /var/www
(or a subfolder)
回答3:
Thank you Ganesh and Thomas for your helpful responses. Applying their advice, I just added a file playndev.html
with the following code (this is similar to what is auto-generated by GWT) to my site directory:
<!DOCTYPE html>
<html>
<head>
<title>PlaynDev</title>
</head>
<body bgcolor="white">
<h2>PlaynDev HTML</h2>
<script src="playndev.nocache.js"></script>
</body>
</html>
The updated directory tree:
/var/www/playndev/
├── clear.cache.gif
├── F23CD74BBFAF29D08D2B82AA57A90407.cache.html
├── gwt-voices.swf
├── hosted.html
├── images
│ └── bg.png
├── playdev.html <--- added host page
└── playndev.nocache.js
On my machine, I access the page at http://localhost/playndev/playndev.html
来源:https://stackoverflow.com/questions/10203455/when-i-compile-playn-core-code-to-html-in-eclipse-where-do-i-find-the-js-html-f