久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      web項(xiàng)目中各種路徑的獲取

      以工程名為/DemoWeb為例: 

      訪問的jsp為:http://localhost:8080/DemoWeb/test/index.jsp 

      1 JSP中獲得當(dāng)前應(yīng)用的相對路徑和絕對路徑 

      (1)得到工程名:request.getContextPath() 

      結(jié)果:/DemoWeb 

      (2)得到包含工程名的當(dāng)前頁面全路徑:request.getRequestURI() 

      結(jié)果:/DemoWeb/test/testpath.jsp 

      (3)得到IE地址欄地址:request.getRequestURL() 

      結(jié)果:http://localhost:8080/DemoWeb/test/testpath.jsp 

      (4)得到當(dāng)前頁面所在目錄下全名稱:request.getServletPath() 

      結(jié)果:/test/testpath.jsp 

      (5)得到頁面所在服務(wù)器的全路徑(實(shí)際的路徑)application.getRealPath(“testpath.jsp”) 

      結(jié)果:D:Develop Filesapache-tomcat-5.5.15apache-tomcat-5.5.15webappsDemoWebtestpath.jsp 

      D:Develop Filesapache-tomcat-5.5.15apache-tomcat-5.5.15tomcat的安裝路徑 

      2.java Class中獲得相對路徑,絕對路徑的方法 

      (1)類的絕對路徑: 

      System.out.println(TestPath.class.getResource(“/”).getPath()); 

      結(jié)果:/E:/workspace/workspace_tcc/DemoWeb/WebRoot/WEB-INF/classes/ 

      System.out.println(TestPath.class.getResource(“”)); 

      結(jié)果:file:/E:/workspace/workspace_tcc/DemoWeb/WebRoot/WEB-INF/classes/demo1/ 

      (2)得到工程的路徑:System.getProperty(“user.dir”) 

      結(jié)果:E:workspaceworkspace_tccDemoWeb 

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號