BasesPath路徑

1. request.getSchema()可以返回當前頁面使用的協議,http 或是 https;


2. request.getServerName()可以返回當前頁面所在的服務器的名字;


3. request.getServerPort()可以返回當前頁面所在的服務器使用的端口,比如8080等;


4. request.getContextPath()可以返回當前頁面所在的應用的名字;

舉例分析:

http         ://       localhost       :      8080         /student-manage   /"
request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()  +  path          +"/";

關於路徑的特殊符號:"/"代表根目錄,".."代表上一層目錄,而"../../"所代表的是上一層目錄的上一層目錄。


發佈了33 篇原創文章 · 獲贊 22 · 訪問量 15萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章