我有一些图像存储在/图像问题是,我希望从类返回像这样的网址。Java:从Java类返回相对URL?
/images/test.png
的问题是,在我的机器我的网址是在
http://localhost/myApp
的形式和生产及其在
http://www.mysite.com
形式,所以我不能只是返回/图像,因为这不适用于开发机器
我想我想在Java中做的是山姆Ë作为德JSTL标签做
<c:url
所以,当我在我的机器,它将返回
/myApp/images/test.png
,并在生产
/images/test.png
谁能帮助?
在此先感谢
相关:http://stackoverflow.com/questions/3655316/browser-cant-access-css -and-images-when-calling-a-servlet-which-forwards-to-aj/3658735#3658735 – BalusC 2012-02-22 17:26:27