星期五, 8月 07, 2015

[Java] Granule 解決tomcat8 檔案路徑回傳null問題

https://github.com/JonathanWalsh/Granule

最近找了這個工具來幫js/css瘦身,在tomcat 8下轉換assets file路徑會在getRealPath下產生Exception。

The parameter for getRealPath() is a 'virtual path' which - unfortunately - is a concept used in the Java docs but not actually defined anywhere. It is assumed to be a path to a resource in your web application and the separator in that case is always '/' regardless of platform.

解決方法要在html頁面引用javascript file時,要多加一個/





沒有留言:

張貼留言

留個話吧:)

其他你感興趣的文章

Related Posts with Thumbnails