關於javaweb地址欄技巧

例如:假設我們當前的地址是http://www.sina.com/admin/detail.jsp?id=5&type=7

HttpServletRequest request;
request.getRequestURL()得到的值是http://www.sina.com/admin/detail.jsp
request.getQueryString()得到的值是 id=5&type=7
request.getServletPath();//得到的值是 /admin/detail.jsp
request.getParameter("id") 5
request.getParameter("type")7
前臺js:
location.search()<wbr>得到<wbr></wbr></wbr>id=5&type=7
訪問的相對地址
 
會跳轉到 http://www.sina.com/login.jsp
替換第一個"/"後面的內容
 
會跳轉到<wbr></wbr>http://www.sina.com/admin/login.jsp
替換最後一個"/"後面的內容
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章