茄子在线看片免费人成视频,午夜福利精品a在线观看,国产高清自产拍在线观看,久久综合久久狠狠综合

    <s id="ddbnn"></s>
  • <sub id="ddbnn"><ol id="ddbnn"></ol></sub>

  • <legend id="ddbnn"></legend><s id="ddbnn"></s>

    jsp中獲取當(dāng)前目錄的方法
    來源:易賢網(wǎng) 閱讀:1242 次 日期:2016-07-01 08:59:00
    溫馨提示:易賢網(wǎng)小編為您整理了“jsp中獲取當(dāng)前目錄的方法”,方便廣大網(wǎng)友查閱!

    本文實例講述了jsp中獲取當(dāng)前目錄的實現(xiàn)方法,分享給大家供大家參考。具體實現(xiàn)方法如下:

    1、利用system.getproperty()函數(shù)獲取當(dāng)前路徑:

    代碼如下:

    system.out.println(system.getproperty(user.dir));//user.dir指定了當(dāng)前的路徑

    2、使用file提供的函數(shù)獲取當(dāng)前路徑:

    代碼如下:

    file directory = new file();//設(shè)定為當(dāng)前文件夾

    try{

    system.out.println(directory.getcanonicalpath());//獲取標(biāo)準(zhǔn)的路徑

    system.out.println(directory.getabsolutepath());//獲取絕對路徑

    }catch(exceptin e){}

    file.getcanonicalpath()和file.getabsolutepath()大約只是對于new file(.)和new file(..)兩種路徑有所區(qū)別。

    # 對于getcanonicalpath()函數(shù),“.就表示當(dāng)前的文件夾,而”..“則表示當(dāng)前文件夾的上一級文件夾

    # 對于getabsolutepath()函數(shù),則不管”.”、“..”,返回當(dāng)前的路徑加上你在new file()時設(shè)定的路徑

    # 至于getpath()函數(shù),得到的只是你在new file()時設(shè)定的路徑

    比如當(dāng)前的路徑為 c:test :

    代碼如下:

    file directory = new file(abc);

    directory.getcanonicalpath(); //得到的是c:testabc

    directory.getabsolutepath(); //得到的是c:testabc

    direcotry.getpath(); //得到的是abc

    file directory = new file(.);

    directory.getcanonicalpath(); //得到的是c:test

    directory.getabsolutepath(); //得到的是c:test.

    direcotry.getpath(); //得到的是.

    file directory = new file(..);

    directory.getcanonicalpath(); //得到的是c:

    directory.getabsolutepath(); //得到的是c:test..

    direcotry.getpath(); //得到的是..

    獲取 java 程序當(dāng)前的工作目錄

    代碼如下:

    file file = new file(t.tmp);

    string fullpath = file.getabsolutepath();

    ① request.getrealpath:

    方法:request.getrealpath(/)

    得到的路徑:c:program filesapache software foundationtomcat 5.5webappsstrutstest

    方法:request.getrealpath(.)

    得到的路徑:c:program filesapache software foundationtomcat 5.5webappsstrutstest.

    方法:request.getrealpath()

    得到的路徑:c:program filesapache software foundationtomcat 5.5webappsstrutstest

    方法:request.getrealpath(web.xml)

    得到的路徑:c:program filesapache software foundationtomcat 5.5webappsstrutstestweb.xml

    ② request.getparameter();

    actionform.getmyfile();

    方法:string filepath = request.getparameter(myfile);

    得到的路徑:d:vss安裝目錄users.txt

    方法:string filepath = actionform.getmyfile();

    得到的路徑:d:vss安裝目錄users.txt

    希望本文所述對大家的jsp程序設(shè)計有所幫助。

    更多信息請查看網(wǎng)頁制作
    易賢網(wǎng)手機(jī)網(wǎng)站地址:jsp中獲取當(dāng)前目錄的方法
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2026國考·省考課程試聽報名

    • 報班類型
    • 姓名
    • 手機(jī)號
    • 驗證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報警專用圖標(biāo)