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

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

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

    jsp判斷移動(dòng)設(shè)備的正則
    來源:易賢網(wǎng) 閱讀:1033 次 日期:2015-01-28 11:44:12
    溫馨提示:易賢網(wǎng)小編為您整理了“jsp判斷移動(dòng)設(shè)備的正則”,方便廣大網(wǎng)友查閱!

    天貓php判斷移動(dòng)設(shè)備的正則(個(gè)人猜測(cè)),覺得很好用,于是就決定移植到j(luò)sp里面,大家可以參考下

    看到了一篇很好的文章, 《在天貓,前端做什么?》,里面有天貓php判斷移動(dòng)設(shè)備的正則(個(gè)人猜測(cè)),覺得很好用,于是就決定移植到j(luò)sp里面。

    jsp文件名為 index.jsp,其實(shí)也可以使用過濾器來進(jìn)行攔截,然后跳轉(zhuǎn)到其他域名去。

    完整代碼如下:

    代碼如下:

    <import=java.util.regex.matcher%>

    < import=java.util.regex.pattern%>

    <%@ page language=java pageencoding=utf-8%>

    <%!

    // b 是單詞邊界(連著的兩個(gè)(字母字符 與 非字母字符) 之間的邏輯上的間隔),

    // 字符串在編譯時(shí)會(huì)被轉(zhuǎn)碼一次,所以是 b

    // b 是單詞內(nèi)部邏輯間隔(連著的兩個(gè)字母字符之間的邏輯上的間隔)

    string phonereg = b(ip(hone|od)|android|opera m(ob|in)i

    +|windows (phone|ce)|blackberry

    +|s(ymbian|eries60|amsung)|p(laybook|alm|rofile/midp

    +|laystation portable)|nokia|fennec|htc[-_]

    +|mobile|up.browser|[1-4][0-9]{2}x[1-4][0-9]{2})b;

    string tablereg = b(ipad|tablet|(nexus 7)|up.browser

    +|[1-4][0-9]{2}x[1-4][0-9]{2})b;

    pattern phonepat = pattern.compile(phonereg, pattern.case_insensitive);

    pattern tablepat = pattern.compile(tablereg, pattern.case_insensitive);

    public boolean checkmobile(string useragent){

    if(null == useragent){

    useragent = ;

    }

    // 匹配

    matcher matcherphone = phonepat.matcher(useragent);

    matcher matchertable = tablepat.matcher(useragent);

    if(matcherphone.find() || matchertable.find()){

    return true;

    } else {

    return false;

    }

    }

    %>

    <%

    string path = request.getcontextpath();

    string basepath = request.getscheme()+://+request.getservername()+:+request.getserverport()+path+/;

    //

    string useragent = request.getheader( user-agent ).tolowercase();

    if(null == useragent){

    useragent = ;

    }

    if(checkmobile(useragent)){

    response.sendredirect(basepath+download.html);

    //request.getrequestdispatcher(/download.html).forward(request,response);

    } else {

    response.sendredirect(basepath+index.html);

    //request.getrequestdispatcher(/index.html).forward(request,response);

    }

    //

    %>

    <!doctype html>

    <html lang=zh-cn>

    <head>

    <base href=<%=basepath%>>

    <title>測(cè)試移動(dòng)設(shè)備跳轉(zhuǎn)</title>

    <meta http-equiv=pragma content=no-cache>

    <meta http-equiv=cache-control content=no-cache>

    <meta http-equiv=expires content=0>

    <meta http-equiv=keywords content=測(cè)試,移動(dòng)設(shè)備,跳轉(zhuǎn)>

    <meta http-equiv=description content=測(cè)試移動(dòng)設(shè)備跳轉(zhuǎn)>

    <!--

    <link rel=stylesheet type=text/css href=styles.css>

    -->

    </head>

    <body>

    <div id=pagecontent style=min-height:500px;_height:500px;>

    正在運(yùn)行!<br>

    </div>

    </body>

    </html>

    更多信息請(qǐng)查看IT技術(shù)專欄

    更多信息請(qǐng)查看腳本欄目
    易賢網(wǎng)手機(jī)網(wǎng)站地址:jsp判斷移動(dòng)設(shè)備的正則
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請(qǐng)考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2026上岸·考公考編培訓(xùn)報(bào)班

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