Jsp中使用絕對路徑${pageContext.request.contextPath }
我們先來看項目這樣一個應用
我們在index.jsp中想要引入Scripts,css包中的文件,怎麼辦,為了避免複雜的相對路徑,公司一般采用絕對路徑,來看代碼:
<link rel='Stylesheet' href='${pageContext.request.contextPath }/css/index.css' />
<script src='${pageContext.request.contextPath }/Scripts/Utility.js'
type='text/javascript'></script>
簡單吧。
最後更新:2017-04-02 06:52:21