开发者

Access filesystem using js within grails project

For learnin开发者_如何学编程g purposes I created a toy project using grails. In this project I would like to play an mp3 file in one of my views. I found an html5/flash mp3 player. But when the music is supposed to play, I have a question.

The HTML 5 player is in the project/web-app/js folder. Everything else is in its normal place. When I try to access a file, let's say "test.mp3" using just the name and extension of the file, where this file is supposed to be?


The file should be relative to whatever your current path is.

That is, if you're at

localhost:8080/myapp/test/test1, and you reference test.mp3, test.mp3 would have to be in the test1 directory. You can use absolute paths, such as /sounds/test.mp3 to reference from the root, but a better solution would be to use ${resource(...)} probably.

Here's the resource documentation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜