欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jsp獲取url路徑的方法分析

 更新時(shí)間:2016年08月22日 10:43:29   作者:sir  
這篇文章主要介紹了jsp獲取url路徑的方法,結(jié)合實(shí)例形式分析了jsp常見的URL操作函數(shù)及具體的功能與運(yùn)行結(jié)果,需要的朋友可以參考下

本文實(shí)例講述了jsp獲取url路徑的方法。分享給大家供大家參考,具體如下:

如果你請(qǐng)求的URL是  http://localhost:8080/demo/Index.jsp

request.getScheme()  //輸出:http

request.getServerName()  //輸出: localhost

request.getServerPort() //輸出: 8080

request.getContextPath()  //輸出: /demo

request.getRequestPath() //輸出: /Index.jsp

request.gerRequestURI() //輸出:  /demo/Index.jsp

request.getRequestURL() //輸出: http://localhost:8080/demo/Index.jsp

request.getRealPath("") //輸出:D:\apache-tomcat-6.0.10\webapps\demo

上面幾個(gè)我都驗(yàn)證過了,除了request.getRequestPath() 無法使用外(估計(jì)這個(gè)函數(shù)已經(jīng)被廢棄掉了吧),其它的顯示都正確。

希望本文所述對(duì)大家JSP程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評(píng)論