What is the point of @{'/path/to/static_content'} in PlayFramework?
If I'm writing an HTML template that contains a reference to a URL in Play!, then I can do it in one of two ways. Like normal HTML:
<img src="/public/images/bananas.png">
Or with the special @{'开发者_如何学运维'}
wrapper:
<img src="@{'/public/images/bananas.png'}">
As far as I can tell, these two methods produce the exact same result, and I don't see a reason to make it any more flexible than it is.
So what's the purpose of the extra characters?
EDIT: Sorry, dumb question.
The @{...}
wrapper adds the context path of your application to the path. Say you deploy your application to run under http://example.com/application/
instead of directly in http://example.com/
this means
<img src="@{'/public/images/bananas.png'}">
would become
<img src="/application/public/images/bananas.png">
精彩评论